Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesnt work in flex div #40

Open
thewayur opened this issue Aug 16, 2020 · 3 comments
Open

doesnt work in flex div #40

thewayur opened this issue Aug 16, 2020 · 3 comments

Comments

@thewayur
Copy link

thewayur commented Aug 16, 2020

i tried it in this http://jsfiddle.net/5ochqtjy/

but it doesnt scroll the article.
any solution?

@hsnaydd
Copy link
Owner

hsnaydd commented May 18, 2021

Hi @thewayur,

Firstly, sorry for the too late reply 😕

I couldn't see any javascript declaration in your fiddle.

@thewayur
Copy link
Author

haha its ok, my bad too :D

check link again : http://jsfiddle.net/5ochqtjy/
still wondering why it is not working... :p

@GaryHilares
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants