ng2-dnd
ng2-dnd copied to clipboard
Drag and Scroll not working togeather
Hi,
On element Drag..its not scrolling down once it reaches the bottom of the Div. Is there any workaround for this?.
Issue is in all the browsers.
Bottom of div or page?
BTW issue is not there with plugin but a missing feature of Safari and other browsers. Also in Chrome and Firefox it works as both of these browsers have this feature inbuilt!
Thanks, Abhishek.
Its bottom of the Div. I have my app in chrome and firefox only. The behaviour is not consistent ..it works only sometimes but not always.
I have used dnd everywhere in my project. Its difficult use some other component. Is there any workaround, can we implement scroll on drag in angular 2 while using dnd.
As workaround I use code below, it scrolls page up/down.
For dnd-draggable
:
(drag)="dragHandler($event)"
and handler:
dragHandler(event){
var offset = 150;
var scrollValueDown = 10;
var scrollValueUp = -1*scrollValueDown;
if(event.screenY > 0 && event.screenY < offset){
window.scrollBy(0, scrollValueUp) // up
}
if(event.screenY > (window.outerHeight - offset) && event.screenY < window.outerHeight){
window.scrollBy(0, scrollValueDown) // down
}
}
for information