moveTo icon indicating copy to clipboard operation
moveTo copied to clipboard

doesnt work in flex div

Open thewayur opened this issue 4 years ago • 3 comments

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

but it doesnt scroll the article. any solution?

thewayur avatar Aug 16 '20 07:08 thewayur

Hi @thewayur,

Firstly, sorry for the too late reply 😕

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

hsnaydd avatar May 18 '21 16:05 hsnaydd

haha its ok, my bad too :D

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

thewayur avatar Jul 24 '21 06:07 thewayur

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.

GaryHilares avatar Jan 18 '22 20:01 GaryHilares