dragscroll icon indicating copy to clipboard operation
dragscroll copied to clipboard

Dynamically re-activate the dragscroll

Open theobix opened this issue 7 years ago • 4 comments

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 ;)

theobix avatar Sep 11 '18 18:09 theobix

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

skanon avatar Sep 26 '18 10:09 skanon

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

raindecastro avatar Jan 06 '19 17:01 raindecastro

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

raindecastro avatar Jan 06 '19 17:01 raindecastro

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

shihabkaranchery avatar Feb 12 '19 12:02 shihabkaranchery