javascript - Angular Directive to ScrollLeft on Drag Bug -


i wrote angular directive called dragscroll scrolls horizontal overflowing element right or left based on dragging on canvas.

please refer fiddle

how works:  1. horizontal scroll @ 0. 2. mousedown @ right end of div , while holding 3. mousemove left  4. page scrolls right.  5. mouseup stops dragging. , vice versa. 

however there bug.

this occurs when 1. horizontal scrollbar in middle of div,  2. "mousedown" on part of canvas (pink) part ,  3.  mousemove left edge, , hold it,   scroll happens continuously, not desired behavior. have not coded scrollleft behavior kind of event. dont know why happening.  

please help.

the problem seems because of default behavior of scrolling event outside of windows browser. can stop default behavior adding e.preventdefault() inside horizontalscroll method.

working fiddle


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -