Hi, this is my 1st post.
I want some effect like in http://www.gucci.com/us/us-english/u.../preview/mens/, making whole div smooth moving left and right.
SO I start with the following code:The div can move left and right suddenly, so I check some code about making moving smooth, so here I have:Code:<SCRIPT> function move (id, x, y) { if (ns4) obj = document.layers[id]; if (ie4) obj = document.all[id].style; obj.xpos = parseInt(obj.left) + parseInt(x); obj.ypos = parseInt(obj.top) + parseInt(y); obj.left = obj.xpos; obj.top = obj.ypos; } </SCRIPT> <a href="javascript:move('divMove',-20,0)">Left</a> | <a href="javascript:move('divMove',20,0)">Right</a> | <a href="javascript:move('divMove',0,-20)">Up</a> | <a href="javascript:move('divMove',0,20)">Down</a> <DIV ID="divMove" STYLE=" position:relative; left:25px; top:10px; width:30px; height:30px; clip:rect(0px 30px 30px 0px); background-color:red; layer-background-color:red;"> </DIV>but it won't continusly move, I guess the condition is wrong and I have to somehow keep tracking the changing style.left. Ajax?Code:<SCRIPT> function slidex (id, x) { step = 5; if (ns4) obj = document.layers[id]; if (ie4) obj = document.all[id].style; obj.xpos = parseInt(obj.left); if (Math.abs(obj.xpos - x) > step) { if (x < 0) step = - step; obj.xpos += step; obj.left = obj.xpos; setTimeout("slidex('" + id + "'," + x + ")", 30); } } </SCRIPT> <a href="javascript:slidex('divSlide',-200)">Go Left</a> | <a href="javascript:slidex('divSlide',100)">Go Right</a> <DIV ID="divSlide" STYLE=" position:relative; left:25px; top:10px; width:30px; height:30px; clip:rect(0px 30px 30px 0px); background-color:red; layer-background-color:red;"> </DIV>
I spent quite few hours and am pulling my hair, and hope someone will enlighten me on this issue.
Thanks in advance!



Reply With Quote
please see 

Bookmarks