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

Pause on hover and exclusively attach to scroll #5

Open
jtamudo opened this issue Aug 25, 2023 · 3 comments
Open

Pause on hover and exclusively attach to scroll #5

jtamudo opened this issue Aug 25, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@jtamudo
Copy link

jtamudo commented Aug 25, 2023

Hey there,

I was playing with your library to implement it in my sites and wanted to achieve a pause on hover. Already tried your methods and properties and can´t get this functional.
Apart from that, I also wanted to achieve a paused marquee that only moves when scrolling (no loop movement once the scroll is produced). I also couldn´t achieve that using your docs params.

I would be very grateful if you could provide a small code with these features. If they aren´t achievable with reeller please tell me. This was a headache for me.
Keep the awesome work.

@Drafteed
Copy link
Member

Drafteed commented Oct 9, 2023

Try this:

import Reeller from 'reeller';
import gsap from 'gsap';

Reeller.registerGSAP(gsap);

const reeller = new Reeller({
    container: '.my-reel',
    wrapper: '.my-reel-wrap',
    itemSelector: '.my-reel-item',
    speed: 10,
});

reeller.filler.container.addEventListener('mouseenter', () => reeller.pause());
reeller.filler.container.addEventListener('mouseleave', () => reeller.resume());

@Drafteed Drafteed added the enhancement New feature or request label Oct 9, 2023
@benjaminhtr
Copy link

Same problem here! It would be great if there was a method to change the speed on hover. Something like this:

reeller.filler.container.addEventListener('mouseenter', () => reeller.changeSpeed(5));
reeller.filler.container.addEventListener('mouseleave', () => reeller.changeSpeed(10));

It could also be an option to write

reeller.filler.container.addEventListener('mouseenter', () => reeller.changeSpeed(0));

to pause the marquee.

@Drafteed
Copy link
Member

Drafteed commented Nov 8, 2023

@benjaminhtr You can do this without any problems by operating gsap timeline.

reeller.filler.container.addEventListener('mouseenter', () => reeller.tl.timeScale(2));
reeller.filler.container.addEventListener('mouseleave', () => reeller.tl.timeScale(1));

In cases of reverse movement, use negative values:

reeller.filler.container.addEventListener('mouseenter', () => reeller.tl.timeScale(-2));
reeller.filler.container.addEventListener('mouseleave', () => reeller.tl.timeScale(-1));

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

No branches or pull requests

3 participants