zoukankan      html  css  js  c++  java
  • js滑动门及对像的使用

    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]).onmouseover = 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";
                      }
                  }
              },
              def: function (menus, divs, openClass, closeClass, menu, divshow) {
                  var _this = this;
                  for (var j = 0; j < menus.length; j++) {
                      _this.$(menus[j]).className = closeClass;
                      _this.$(divs[j]).style.display = "none";
                  }
                  _this.$(menu).className = openClass;
                  _this.$(divshow).style.display = "block";
              },
              $: function (oid) {
                  if (typeof (oid) == "string")
                      return document.getElementById(oid);
                  return oid;
              }
          }

    使用
     var SDmodel = new scrollDoor(); 
     SDmodel.sd(["d1","d2"],["c1","c2"],"li_up","");

    案例
    http://esf.sh.soufun.com/agent/agtagent/27686210.htm
  • 相关阅读:
    Jzoj4765 Crisis
    Jzoj4764 Brothers
    Jzoj4764 Brothers
    Jzoj4756 幻象
    Jzoj4756 幻象
    Jzoj4755 快速荷叶叶变换
    Jzoj4755 快速荷叶叶变换
    力扣算法题—059螺旋矩阵
    力扣算法题—058最后一个单词长度
    力扣算法题—057插入区间
  • 原文地址:https://www.cnblogs.com/zhangji/p/3586010.html
Copyright © 2011-2022 走看看