關於噹噹網的js代碼

來源:互聯網
上載者:User

標籤:int   lin   選項卡   dex   下拉   close   var   定時器   ima   


/*window.onload = function(){
    //擷取所有的tab選項卡
    var tabs = document.getElementById("tabsMin").getElementsByTagName("li");
    var contents = document.getElementById("newbooks_main").getElementsByTagName("div");
    
    for(var i = 0;i<tabs.length;i++){
        tabs[i].index = i;
        tabs[i].onmouseover = function(){
            for(var j = 0;j<tabs.length;j++){
                tabs[j].className = "";
                contents[j].style.display = "none";
            };
            this.className = "cur";
            contents[this.index].style.display = "block";
        };
    }
};*/
$(function () {
    /*最新上架版塊TAB轉場效果*/
        $("#tabsMin li").mouseover(function () {
            $(this).addClass("cur").siblings().removeClass("cur");
            $("div .bookSort").hide().eq($(this).index()).show();
        });
        
        //定時器
        var nowRow=0;
        function times(){
            if(nowRow==$("#focus li").length) nowRow=0;
            $("#focus li").eq(nowRow).addClass("cur").siblings().removeClass("cur");
            $("#focusimg").attr("src","images/dd_scroll_"+(nowRow+1)+".jpg");    
            nowRow++;
        }
        var time=setInterval(times,1000);
        //投影片
        $("#focus li").mouseover(function(){
            $(this).addClass("cur").siblings().removeClass("cur");
            $("#focusimg").attr("src","images/dd_scroll_"+($(this).index()+1)+".jpg");
            clearInterval(time);
            
        });
        $("#focus li").mouseout(function(){
            time=setInterval(times,1000);
        });
        //浮動廣告
        $("#right").css({"position":"fixed","top":"100px"});
        //關閉浮動廣告
        $("#dd_close").click(function(){
            $(this).parent().hide();    
        });
        /*右側隨滑鼠滾動的廣告圖片  
        var rightT;
        var rightR;
        var objRight;
        var rightWidth;
        function place(){
            objRight=document.getElementById("right");
            rightWidth=document.getElementById("right1").width;
            if(objRight.currentStyle){//IE瀏覽器
               rightT=parseInt(objRight.currentStyle.top);
               rightR=parseInt(objRight.currentStyle.right);
            }
           else{//fireFox瀏覽器
               rightT=parseInt(document.defaultView.getComputedStyle(objRight,null).top);
               rightR=parseInt(document.defaultView.getComputedStyle(objRight,null).right);
            }
        
        }
        
        function move(){
            objRight.style.top=rightT+parseInt(document.documentElement.scrollTop + document.body.scrollTop)+"px";
            objRight.style.left=parseInt(document.documentElement.scrollLeft+document.body.scrollLeft)+parseInt(document.documentElement.clientWidth)-rightR-rightWidth+"px";
            document.getElementById("dd_close").style.left="63px";
            }
        
        place();
        window.onscroll=move;
        
         右側隨滑鼠滾動的廣告圖片關閉
        objRight.onclick=function(){
            objRight.style.display="none";
            }*/
        
        //下拉式功能表
        $("[alt=‘arrow‘]").parent().hover(
            function(){
                $("#dd_menu_top_down").show();
            },
            function(){
                $("#dd_menu_top_down").hide();
            }
        );
        //自動滾動廣告
        $("#dome2").html($("#dome1").html());
        function timee(){
            if($("#dome2")[0].offsetTop-$("#dome")[0].scrollTop<=0){
                $("#dome")[0].scrollTop-=$("#dome1")[0].offsetHeight
            }else{
                $("#dome")[0].scrollTop++;
            }
        }
        var start=setInterval(timee,1)
        $("#dome").hover(
        function(){
            clearInterval(start);
        },
        function(){
         start=setInterval(timee,1)
        }
        );
        
});

關於噹噹網的js代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.