HighDots Forums  

drag doesn't work well ( too slow)

alt.html.dhtml alt.html.dhtml


Discuss drag doesn't work well ( too slow) in the alt.html.dhtml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ben
 
Posts: n/a

Default drag doesn't work well ( too slow) - 12-04-2004 , 05:54 AM






Hi,

Clicking down and dragging the rabbit works without error but very slowly
and not smoothly, but i can't find my error in the code below:
(i use IE 6.0)

<BODY oncontextmenu="return false" scroll=no >
<IMG ID="rabbit"
STYLE="Position:absolute;left:200;top:150;width:10 0;height:150;z-index:1;
filter:blendtrans" SRC="bugs.gif" onMouseDown="downrabbit()"
onMouseUp="uprabbit()" width="100" height="149">

<script language=javascript>
var lap;
var sel;
var strid;
var x,y;
flag=0;
lap=document.getElementById("rabbit").style

function downrabbit()
{
lap.width=100
lap.height=149
strid=window.event.srcElement.id
if (strid=="rabbit")
sel=strid
}

function dragrabbit()
{
if (sel == "rabbit")
{
x=window.event.x
y=window.event.y
lap.left = x-50
lap.top = y-60
window.event.cancelBubble = true
window.event.returnValue = false
}
}

function uprabbit()
{
if (sel == "rabbit")
{
if (x<50)
lap.left=50
if (y<50)
lap.top=50
if (x>700)
lap.left=700
if (y>350)
lap.top=350
}
}

document.getElementById("rabbit").ondragstart=drag rabbit
</script>

</BODY>

thanks ben




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.