animate while the mouse is over
I have this page where I try to scroll an image using a div:
http://carloeasantos.webcindario.com/forum/index.html
the blue div on top, is responsible for changing the margin-top of the container image.
but as I pass the mouse on div, scrolling is all done at once, I have softer, as in slow animate
some ideia?
script:
- $j("#btTop").mouseover(function(){
- var hImg = $j("#cImg img").attr('height');
- var hHide = hImg - $j("#cImg").height();
- while(hHide>0){
- var mT = $j("#cImg").css('margin-top').slice(0,-2);
- if(mT>-200){
- $j("#cImg").css('margin-top',mT-1+"px");
- //wait (1000);
- }
- hHide--;
- }
- });
HTML:
- <div id="square">
- <div class="btHor" id="btTop"></div>
- <div id="cImg">
- <img src="1_Imagem Zoom+.jpg" width="1280" height="800" />
- </div>
- </div>