zoukankan      html  css  js  c++  java
  • 关于当当网的js代码


    /*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)
            }
            );
            
    });

  • 相关阅读:
    延时显示(类QQ头像显示)
    getComputedStyle与currentStyle获取样式(style/class)
    私单
    厂里
    009 vue的响应式方法
    008 vue的v-for的使用及key的使用
    007 v-if,v-else-if,v-else和v-show
    006 Vue的v-on
    005 Vue 计算属性
    004 Vue的v-bind属性
  • 原文地址:https://www.cnblogs.com/hudangui/p/6273104.html
Copyright © 2011-2022 走看看