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

Dynamically re-activate the dragscroll #46

Open
FireGreeks opened this issue Sep 11, 2018 · 4 comments
Open

Dynamically re-activate the dragscroll #46

FireGreeks opened this issue Sep 11, 2018 · 4 comments

Comments

@FireGreeks
Copy link

FireGreeks commented Sep 11, 2018

Searching for an answer I read this issue : #4
So what I am trying to do is reactivate the dragscoll after using reset()

I tried to rename the className, but it didn't work - after resetting it I can't find a way to put it back up. Maybe I am missing something....

if (isDragged) {
     document.body.className = "";
     dragscroll.reset()
} else {
      document.body.className = "dragscroll";
}`

Great library btw ;)

@skanon
Copy link

skanon commented Sep 26, 2018

dragscroll.reset() does not only remove the existing listener, it also adds new ones (at least from my experience)

if (isDragged) {
     document.body.className = "";
} else {
      document.body.className = "dragscroll";
}
dragscroll.reset()

should do the trick

@raindecastro
Copy link

Any ideas on how I'll be able to call this in React?

@raindecastro
Copy link

Found the solution for resetting on react if anyone needs to know.
dragscroll.reset() should be called inside componentDidMount()

@shihabkaranchery
Copy link

shihabkaranchery commented Feb 12, 2019

how enable it on angular? it works only once after page reload

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

4 participants