Hello all,
I'm new to jQuery UI and I hope somebody can point me in the right
direction. I'm having a problem in Firefox 3.0.8 when attempting to
use the draggable function. If, in one of the draggable events, I
evaluate ui.position.left (or top), I find that the value is not an
integer, but is a floating point value.
Here's a sample call from my page:
$(function() {
$(".dragobject").draggable({ containment: '#container',
scroll: false,
stop: function(e, ui) {
var pos = ui.position;
alert('left: ' + pos.left + ', top: ' + pos.top);
}
});
});
The value for left shows up as something like 440.98333740234375.
This is only happening in Firefox. In IE, Chrome, and Safari, I get
integers from the same call.
I've tried to make sure all of the margins/padding/etc on my page are
specified in pixels. Any other thoughts as to what could be causing
this? I suppose I can just truncate the value, but I'd like to know
what the root cause is.
The full source of my test page is below.
Thanks in advance,
Brett
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Drag Sample</title>
<script src="Scripts/jquery-1.3.2.min.js" type="text/javascript"></
script>
<script src="Scripts/ui.core.js" type="text/javascript"></script>
<script src="Scripts/ui.draggable.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$(".dragobject").draggable({ containment: '#container',
scroll: false,
stop: function(e, ui) {
var pos = ui.position;
alert('left: ' + pos.left + ', top: ' + pos.top);
}
});
});
</script>
<style type="text/css">
html, body
{
margin: 0px 0px 0px 0px;
}
#foo
{
top: 100px;
left: 100px;
height: 100px;
width: 100px;
position: absolute;
}
.dragobject
{
background-color: #eeeeee;
}
#container
{
width: 800px;
height: 600px;
border: solid 1px #888888;
position: relative;
}
</style>
</head>
<body>
<div id="container">
<div id="foo" class="dragobject">
<span>Foo</span>
</div>
</div>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---