Jump to content
  • 0

скрипт не хочет работать в IE когда мышка покидает окно броузера


mozg4d
 Share

Question

Ура, наконец мой суперскрипт)) заработал!

В нём я перетаскиваю объёкт мышкой. Во всех броузерах объект можно перетащить куда-угодно за пределы броузера (видна лишь та часть которая остаётся в окне броузера), но IE - перестаёт обрабатывать скрипт когда мышка выходит за его окна броузера.. Есть ли способ с этим бороться? или дело не в скрипте а в логике работы броузера?

Вот скрипт, если нитересно..

<script>
var obj1;
var obj2;
var v;
function drag_start(w,e)
{ if (!e) e = event;
v=w;
obj1 = document.getElementById("i1");
posx1 = e.clientX*3 - parseInt(obj1.style.left);
obj2 = document.getElementById("i2");
posx2 = e.clientX*3 - parseInt(obj2.style.left);
e.preventDefault();}
function drag_stop(){obj1=null;obj2=null;}
function drag(e)
{ if (!e) e = event;
if(parseInt(obj1.style.left)>v){posx1=posx1+2*v}
if(parseInt(obj1.style.left)<-v){posx1=posx1-2*v}
obj1.style.left = e.clientX*3 - posx1;
if(parseInt(obj2.style.left)>v){posx2=posx2+2*v}
if(parseInt(obj2.style.left)<-v){posx2=posx2-2*v}
obj2.style.left = e.clientX*3 - posx2;}
document.onmousemove = drag;
document.onmouseup = drag_stop;
</script>

<div id="con" style=position:absolute;left:0;top:0;cursor:move;width:763;height:439;overflow:hidden onmousedown="event.preventDefault()">
<img id="i1" src=p.jpg width=3648 height=439 style=position:absolute;left:0;top:0 onmousedown=drag_start(3648,event)>
<img id="i2" src=p.jpg width=3648 height=439 style=position:absolute;left:3648;top:0 onmousedown=drag_start(3648,event)>
<div>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy