2012-03-29 5 views
0

스크롤 방향을 DOWN으로 변경하려면 http://javascript.about.com/library/blcvert.htm에서 스크립트를 조정해야합니다.연속 이미지 수직 스크롤러

아무도 도와 줄 수 있습니까?

물론 누군가가 동일한 효과를내는 다른 스크립트를 알고 있거나 가지고 있다면 도움이 될 것입니다.

탄원

P. 스크립트 (읽을 수있는 형식입니다) :


    var imgAry1 = ['img1.png','img2.png']; 

    function startCloud() { 
     new mq('clouds', imgAry1, 380); 
     mqRotate(mqr); 
    } 

    $(document).ready(function() { 
     startCloud(); 
    }); 

    var mqr = []; 

    function mq(id, ary, heit) { 
    this.mqo=document.getElementById(id); 
    var wid = this.mqo.style.width; 
    this.mqo.onmouseout=function() { mqRotate(mqr); }; 
    this.mqo.onmouseover=function() { clearTimeout(mqr[0].TO); }; 
    this.mqo.ary=[]; 
    var maxw = ary.length; 
    for (var i=0;i<maxw;i++) { 
     this.mqo.ary[i]=document.createElement('img'); 
     this.mqo.ary[i].src=ary[i]; 
     this.mqo.ary[i].style.position = 'absolute'; 
     this.mqo.ary[i].style.top = (heit*i)+'px'; 
     this.mqo.ary[i].style.height = heit+'px'; 
     this.mqo.ary[i].style.width = wid; 
     this.mqo.appendChild(this.mqo.ary[i]); 
    } 
    mqr.push(this.mqo); 
    } 

    function mqRotate(mqr) { 
    if (!mqr) return; 
    for (var j=mqr.length - 1; j > -1; j--) { 
     maxa = mqr[j].ary.length; 
     for (var i=0;i<maxa;i++) { 
      var x = mqr[j].ary[i].style; 
      x.top=(parseInt(x.top,10)-1)+'px'; 
     } 
     var y = mqr[j].ary[0].style; 
     if (parseInt(y.top,10)+parseInt(y.height,10)<0) { 
      var z = mqr[j].ary.shift(); 
      z.style.top = (parseInt(z.style.top) + parseInt(z.style.height)*maxa) + 'px'; 
      mqr[j].ary.push(z); 
     } 
    } 
    mqr[0].TO=setTimeout('mqRotate(mqr)',10); 
    } 

답변

0
이 라인에

:

x.top=(parseInt(x.top,10)-1)+'px';

당신이 수를 구문 분석, 픽셀 x.top을 말한다, 빼기 하나는 추가 'px'다시. 상단에서 요소의 위치는 이 매번 1 씩 감소한이므로 까지이됩니다. 으로 이동하려면 을 입력하고을 입력하면됩니다.

x.top=(parseInt(x.top,10)+1)+'px';

은 또한 당신이 :)

을 링크 된 페이지에서이 가설을 테스트
관련 문제