Showing posts with label js. Show all posts
Showing posts with label js. Show all posts

Saturday, March 01, 2008

script.aculo.us drag and sort scrolling bug

For those who uses the script.aculo.us drag and drop js libs, this is an explain for fixing a scrolling bug.
if your dragable element has a scrolling bar, when you try to scroll it also start dragging the element.
i fixed this bug, do the following steps and it will work perfectly:
open the file "dragdrop.js" for edit, after the following code:
if((tag_name = src.tagName.toUpperCase()) &&
( tag_name=='INPUT'
tag_name=='SELECT'
tag_name=='OPTION'
tag_name=='BUTTON'
tag_name=='TEXTAREA')) return;

add the following line:
if( src.undragable!=null) return;

this line means that if there's a tag in the element that called "undragable" so it wont move the element.

when you want to set an element with a scrollbar, just add the "undragable" tag to it and it will fix the problem, for example:


< d iv height="50%" width="100%"undragable style="height: 200px; overflow:auto;scrollbar-arrow-color: #808080; scrollbar-track-color: #FFFFFF; scrollbar-face-color: #FFFFFF; scrollbar-highlight-color: #808080; scrollbar-3dlight-color: #FFFFFF; scrollbar-darkshadow-color: #FFFFFF;scrollbar-shadow-color: #808080;"