//命名空间
var base = {};

//class
base.gClass={};

//鼠标hover交互方法: 注册对象的hover的class特性以及mouseMoveIn,mouseMoveOut方法
base.gClass.hover=(function(creat){
    var creat=function(obj,className,mouseoverFun,mouseleaveFun){
        this.obj=obj;
        this.className=className;
        this.mouseoverFun=mouseoverFun;
        this.mouseleaveFun=mouseleaveFun;

        this.mouseoverFun=='' || this.mouseoverFun == undefined ? this.mouseoverFun=function(){} : void (0);
        this.mouseleaveFun=='' || this.mouseleaveFun == undefined ? this.mouseleaveFun=function(){} : void (0);
    };
    creat.prototype={
        hoverFun:function(){
            var _this=this;
            var obj;
            $(document).on('mouseover',_this.obj,function(e){
                obj= $(this);
                obj.addClass(_this.className);
                _this.mouseoverFun(obj);
            }).on('mouseleave',_this.obj,function(e){
                obj.removeClass(_this.className);
                _this.mouseleaveFun(obj);
            });
        }
    }
    return creat;
})();

 

相关文章:

  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2021-10-31
  • 2021-06-10
  • 2021-10-12
  • 2021-07-16
  • 2022-01-16
  • 2022-02-17
  • 2021-07-08
相关资源
相似解决方案