Browse Source

Add scroll animation when switching slides

dev
Philipp Lang 4 years ago
parent
commit
2698ef03a2
  1. 4
      assets/js/app.js
  2. 2
      views/stepper.twig.htm

4
assets/js/app.js

@ -133,6 +133,10 @@ window.stepper = {
}, 500);
}
jQuery('html, body').stop().animate({
'scrollTop': jQuery('#stepper-main').offset().top
}, 600, 'swing');
this.$nextTick(function() {
_self.$refs.slider.scrollLeft = _self.$refs.slider.scrollWidth / 4 * index;
});

2
views/stepper.twig.htm

@ -1,4 +1,4 @@
<div class="stepper"
<div id="stepper-main" class="stepper"
x-data="{ ...stepper, step: {{data.step}}, value: { ...stepper.value, kind: '{{data.kind}}', {% if data.kind %} {{data.kind}}: { ...stepper.value.{{data.kind}}, eigenkapital: {{data.eigenk}}, kaufpreis: {{data.kaufpreis}} } {% endif %} }, sprite: '{{sprite|raw}}' }"
{% if data.step == 1 %} x-init="slideTo(null, {{data.step}})" {% endif %}>

Loading…
Cancel
Save