Solved

IE scrollbar drag and drop bug

Posted on 2006-07-13
2
227 Views
Last Modified: 2008-03-10
I have a floating div with a onmousedown function to move it. the function sets simpy a var grabbed = true, on mouseup I set grabbed = false. Then I do simply a window.onmousemove and if grabbed is true, then I move the div to follow the pointer. Now the trouble arises if I have a scrollbar on my floating div, if I click on the bar, the onmousedown is executed (thus grabbing the div) but the mouseup is never executed, then the div is never released... the div looks like this :

<div onmousedown='grabit()' onmouseup='releaseit()' id='thediv' style='overflow:auto;height:100'>

<div>

Under firefox it works fine, the bug arises only under IE. How could I arrange this ?
0
Comment
Question by:Drakecoldwinter
2 Comments
 
LVL 2

Author Comment

by:Drakecoldwinter
ID: 17111068
Once again I answer myself trough research, test and error... I have done some code that will ignore the mousedown or up when is over the scrollbar :

var thescrollX = getLeft(document.getElementById('msgbox')) +  
                     document.getElementById('msgbox').offsetWidth - 50;
var thescrollYtop = getTop(document.getElementById('msgbox')) + 15;
var thescrollYbot = getTop(document.getElementById('msgbox')) +
                      document.getElementById('msgbox').offsetHeight - 15;

if((curX>thescrollX )&&(curX<thescrollX+20)&&(curY>thescrollYtop )&&(curY<thescrollYbot)){
                        grabbed=false;}

it is very easy, before doing the onmousedown I check if the cursor is over the scrollbars, if it is the case, I ignore the rest of the code and don't do any drag ;) of course the 50, and 15 must be adjusted for your div ;)
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17117891
Closed, 125 points refunded.
Netminder
Site Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now