zoukankan      html  css  js  c++  java
  • 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;
    })();
  • 相关阅读:
    快速幂求模
    elasticSearch入门
    springboot 停止
    gson
    jetty 入门
    redis工具
    oracle数据库操作
    Spring事务控制和回滚
    SPI
    PLSQLDeveloper_免安装自带client
  • 原文地址:https://www.cnblogs.com/feika/p/4497702.html
Copyright © 2011-2022 走看看