仿淘寶首頁上下滾動(dòng)廣告特效

字號(hào):


    有網(wǎng)友通過qq群想做一個(gè)淘寶首頁的上下翻動(dòng)的特效。通過火狐的firebug查看是通過層的隱藏和定位來實(shí)現(xiàn)的。
    我共用了淘寶的內(nèi)容,然后通過jquery操作對(duì)其進(jìn)行特效實(shí)施。
    查看特效:仿淘寶首頁上下滾動(dòng)廣告特效
    代碼如下:
    jquery代碼
    <script language=javascript>
    <!--
    $(function(){
    var $t=math.floor(math.random()*3); //隨機(jī)產(chǎn)生一個(gè)1-3數(shù)字 默認(rèn)顯示第幾個(gè)
    $(#upc).click(function(){//向上點(diǎn)擊
    $t++;if($t>=2){$t=2;$(this).addclass(disable);};
    $(#rollcontent).animate({top:-194*$t});
    $(#downc).removeclass(disable);
    $(#numshow > em).text($t*3+-+($t+1)*3);
    });
    $(#downc).click(function(){//向下點(diǎn)擊
    $t--;if($t<=0){$t=0;$(this).addclass(disable);}
    $(#rollcontent).animate({top:-194*$t});
    $(#upc).removeclass(disable);
    $(#numshow>em).text($t*3+1+-+($t+1)*3);
    });
    $(#numshow>em).text($t*3+1+-+($t+1)*3);
    if($t==0)$(#downc).addclass(disable);
    if($t==2)$(#upc).addclass(disable);
    $(#rollcontent).animate({top:-194*$t});
    });
    -->
    </script>
    以上就是代碼嘍!