• CSS skills: 2) change hover dynamically by js


    //命名空间
    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;
    })();
  • 相关阅读:
    XMAPP搭建DVWA靶机
    博客滑动相册封面导航教程
    MySQL-分页与排序
    MySQL-子查询
    java方法
    JSP小结
    javaScript入门介绍2
    Codeforces Global Round 13
    第一章、OS引论1
    JavaScript入门介绍2021/02/27
  • 原文地址:https://www.cnblogs.com/feika/p/4497702.html
Copyright © 2020-2023  润新知