473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

draggable inside fixed pos. div problem

1
Background: I have a fixed position div on the bottom om my page. I have then
added a dialog-div into this fixed position one. When I bring up the dialog,
everything works if the the scrollTop is 0. I can drag it around with no problem.

Problem: If the page has scrolled, lets say 100px down (y-axis) and I try to
drag the dialog around, a strange effect appair in non-ie browsers. The dialog
is instantly moved 100px UP while dragging. as soon as I release the mouse button,
the dialog pops back down 100px (to where my pointer is located).

for IE(6) i have the "bottom div" absolute positioned and then I use some
@media-screen-hack to make it fixed-positioned. and in IE i DONT have this
problem and everything works like a charm.

small note: for now in IE i use jquery.ui.draggable and for browsers != IE
i use interface.draggables. IE had issues with interface and other browsers
had issues with jquery.ui :\. im going to look into this in the future and try
to go for one.

Any help is appreciated! How do I solve my dragging-while-scrolled issue?
and maby I should be able to go for just one draggable lib?

Example code that shows the issue (works as intended in IE6, wierd in FF):

[PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
#bottom_area {
position: fixed;
left: 0px;
bottom: 0px;
height: 160px;
width: 500px;
}

#dialog {
position: absolute;
left:0px;
top:0px;
padding:2px;
width:255px;
height:108px;
background-color:#ffffff;
border: 1px solid #000000;
z-index: 30;
}

#dialog_handle {
font: 9px verdana,arial,helvetica;
background-color:#0000ff;
padding:2px;
text-align:left;
height: 14px;
color: #000000;
vertical-align:middle;
}
</style>

<!--[if IE]>
<style type="text/css">
#bottom_area {
position: absolute;
}

@media screen
{
#bottom_area {
position: fixed;
}
* html{
overflow-y: hidden;
}
* html body{
overflow-y: auto;
height: 100%;
}
* html #bottom_area{
position: absolute;
}
}
</style>
<![endif]-->

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="ui.mouse.js"></script>
<script type="text/javascript" src="ui.draggable.js"></script>
<script type="text/javascript" src="ui.resizable.js"></script>
<script type="text/javascript" src="interface.js"></script>
<script type="text/javascript">
$(window).ready(function(){
if(jQuery.browser.msie){
jQuery("#dialog").draggable({
zIndex: 15,
ghosting: false,
handle: '#dialog_handle'
});
} else {
jQuery("#dialog").Draggable({
zIndex: 15,
ghosting: false,
handle: '#dialog_handle'
});
}
for(var i=0;i<90;i++){
$("body").append("crappy text to be able to see the scroll effect...<br>");
}
});
</script>

</head>
<body>
<div id="bottom_area">
<div id="dialog">
<div id="dialog_handle">[DRAG ME AROUND]</div>
</div>
</div>
</body>
</html> [/PHP]

Thanks!
Jan 7 '08 #1
1 3233
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!
Problem: If the page has scrolled, lets say 100px down (y-axis) and I try to
drag the dialog around, a strange effect appair in non-ie browsers. The dialog
is instantly moved 100px UP while dragging. as soon as I release the mouse button,
the dialog pops back down 100px (to where my pointer is located).
The dialog is positioned absolutely at 0,0. Perhaps if it was relative, you may not face this problem.
Jan 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Thanasis \(sch\) | last post by:
Hello to everyone, i'm new to css and i have a question. i have an external css (style.css) , that i link in all html pages. inside the css file there is a class detais declared as follows:...
8
by: rdlebreton | last post by:
Hi, Folks! I've been trying to develop my own version of these draggable layers and I have been limiting myself to IE6...for now. I have looked at some other examples to get ideas of creating...
5
by: Carl Gilbert | last post by:
Hi I am trying to allow a user of a web site to move an image around the page using draggable Divs. I have tried using some script from http://www.mattkruse.com/. In particular:...
2
by: louissan | last post by:
Hi all, I have a slight problem with IE, when everything works with firefox. The goal is to _create_ boxes using the createElement method. And then making it draggable with the mouse. The code...
3
by: Jason | last post by:
I have a hyperlink that is draggable (using Prototype's "new Draggable()" construct). I want to be able to drag the link without actually 'clicking' the link once i end the drag. Is there a way to...
1
by: gezerpunta | last post by:
Hi folks :) We use scriptaculous draggables inside a scrollable div. Everything works fine if we turn on the option "Ghosting" (this enables items to be dragged outside the div with a sroller...
3
by: Sebarry | last post by:
Hi, I have been assigned the daunting task of applying coordinate movements of a draggable div with a small box to the scrolling of the current window. Basically the small box represents the...
6
by: vunet | last post by:
Hello, I hope this is a right place to ask about Scriptaculous library. I started using draggable and droppables effects for the first time and my draggable is simply initialized as new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.