• tab切换,滑动门


      <SCRIPT type=text/javascript>
      jQuery(document).ready(function () {
              changediv(["#ha1","#ha2"],["#hw1","#hw2"],"one")
        })    
          
      function changediv(menus,divs,opclass){
          if(menus.length != divs.length){
              alert("菜单个数与内容痛");
              return false;
              }
        for(var i=0; i<menus.length;i++){
            $(menus[i]).mouseover(function(){
                  //alert("你搞错没有啊");
                // $(this).addClass(opclass).siblings().removeClass("one")
                 for(var j=0; j<menus.length; j++){
                     $(menus[j]).removeClass(opclass);
                     $(divs[j]).css("display","none");
                     }
                //$(this).addClass(opclass);    
                $(this).addClass(opclass)    
                $(divs[$(this).index()]).css("display","block");
                })
            
            }      
          
          }
    </SCRIPT>

    function scrollDoor(){
    }
    scrollDoor.prototype = {
        sd : function(menus,divs,openClass,closeClass){
            var _this = this;
            if(menus.length != divs.length)
            {
                alert("菜单层数量和内容层数量不一样!");
                return false;
            }                
            for(var i = 0 ; i < menus.length ; i++)
            {    
                _this.$(menus[i]).value = i;                
                _this.$(menus[i]).鼠标over事件[请自行修改] = function(){
                        
                    for(var j = 0 ; j < menus.length ; j++)
                    {                        
                        _this.$(menus[j]).className = closeClass;
                        _this.$(divs[j]).style.display = "none";
                    }
                    _this.$(menus[this.value]).className = openClass;    
                    _this.$(divs[this.value]).style.display = "block";                
                }
            }
            },
        $ : function(oid){
            if(typeof(oid) == "string")
            return document.getElementById(oid);
            return oid;
        }
    }

     jQuery(document).ready(function () {
    
    var SDmodel = new scrollDoor();
    
    SDmodel.sd(["an1", "an2","an3","an4","an5","an6"],["adr1", "adr2", "adr3","adr4","adr5","adr6"],"one");
    
    
        })
  • 相关阅读:
    MySQL中的MRR和BKA
    MySQL中的BNL优化器
    MySQL中索引
    MySQL中的两种排序方式: index和filesort
    设计模式之观察者模式
    设计模式之策略模式
    设计模式之模板方法
    java和JavaScript的区别
    HTML 简介--from app (W3)
    与代码同行-五年计划
  • 原文地址:https://www.cnblogs.com/xqschool/p/6033156.html
Copyright © 2020-2023  润新知