moveTo
moveTo copied to clipboard
doesnt work in flex div
i tried it in this http://jsfiddle.net/5ochqtjy/
but it doesnt scroll the article. any solution?
Hi @thewayur,
Firstly, sorry for the too late reply 😕
I couldn't see any javascript declaration in your fiddle.
haha its ok, my bad too :D
check link again : http://jsfiddle.net/5ochqtjy/ still wondering why it is not working... :p
Hi @thewayur! You have to set the container option in the constructor.
HTML:
<article id="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eget vestibulum augue.
...
<a href="#target" class="js-trigger" id="target" data-mt-duration="300">Trigger</a>
</article>
JS:
const moveTo = new MoveTo({
container: document.getElementById('container'),
});
Note that the data-mt-duration
attribute only works when the element is registered as the trigger, not as the target. If you want to add the duration without a trigger, do it in the constructor of the MoveTo
object.
JS:
const moveTo = new MoveTo({
container: document.getElementById('container'),
duration: 300
});
Yet, there is still a different bug. The duration option is not working properly in the given example. With the number 500000
, which should take 500000ms (500s), it took 37s to reach the element for me.