//命名空间
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;
})();

CSS skills: 2) change hover dynamically by js的更多相关文章

  1. CSS skills: 5) jquery hover(over,out)

    $(":div[name=div_edit]").each(function() { $(this).hover(function() { $(this).find("& ...

  2. FCC---Use CSS Animation to Change the Hover State of a Button---鼠标移过,背景色变色,用0.5s的动画制作

    You can use CSS @keyframes to change the color of a button in its hover state. Here's an example of ...

  3. Change :hover CSS properties with JavaScript

    I need to find a way to change CSS :hover properties using JavaScript. For example, suppose I have t ...

  4. Effective前端1:能使用html/css解决的问题就不要使用JS

    div{display:table-cell;vertical-align:middle}#crayon-theme-info .content *{float:left}#crayon-theme- ...

  5. [转]能用HTML/CSS解决的问题就不要使用JS

    原文链接:http://www.codeceo.com/article/html-css-not-js.html 为什么说能使用html/css解决的问题就不要使用JS呢?两个字,因为简单.简单就意味 ...

  6. 能使用html/css解决的问题就不要使用JS

    为什么说能使用html/css解决的问题就不要使用JS呢?两个字,因为简单.简单就意味着更快的开发速度,更小的维护成本,同时往往具有更好的体验,下面介绍几个实例. 1. 导航高亮 导航高亮是一种很常见 ...

  7. 优化 html 标签 为何能用HTML/CSS解决的问题就不要使用JS?

    优化 html 标签 2018年05月11日 08:56:24 阅读数:19 有些人写页面会走向一个极端,几乎页面所有的标签都用div,究其原因,用div有很多好处,一个是div没有默认样式,不会有m ...

  8. sublime格式化js、css、html的通用插件-html js css pretty

    sublime格式化js.css.html的通用插件-html js css pretty: 这个插件可以格式化基本上所有js html css文件,包括写在html中的js代码 ,可以在packag ...

  9. 鼠标悬浮控制元素隐藏与显示 - css中鼠标的hover状态

    需求:当鼠标移动到一个元素A身上时,另外一个元素B显示. 实现原理: A元素与B元素有一个相同的父级. B元素默认隐藏,A元素默认显示. 当鼠标移动到A元素身上时,也可以看做是移动到了A元素的父级身上 ...

随机推荐

  1. VB IE 清除历史记录

    VB删除Cookie,仅适用于IE7版本 IE7版本为我们提供了命令行删除Cookie,清除临时文件缓存,清除历史记录表单的方法,下面是详细的命令运行方式. '注:以下代码仅支持IE7. '清除Int ...

  2. jar,war,ear区别及java基础杂七八

    jar,war,earqu区别 这三种文件都可以看作是java的压缩格式,其实质是实现了不同的封装: jar--封装类war--封装web站点ear--封装ejb.它们的关系具体为:jar:      ...

  3. ocp 1Z0-043 61-130题解析

    61. You are working in an online transaction processing (OLTP) environment. You realize that the sal ...

  4. ADUM1201在隔离RS232中的应用 【瓦特芯收藏】

    ADUM1201在隔离RS232中的应用 引言: RS-232是PC机与工业通信中应用最广泛的一种串行接口.RS-232接口最初是由美国EIA(电子工业联合会)规定的用于计算机与终端设备之间通讯的一种 ...

  5. CodeForces 706A Beru-taxi (数学计算,水题)

    题意:给定一个固定位置,和 n 个点及移动速度,问你这些点最快到固定点的时间. 析:一个一个的算距离,然后算时间. 代码如下: #pragma comment(linker, "/STACK ...

  6. mybatis杂记

    mybatis学习官网: 1.如果项目中使用maven管理,又引用 了mybatis框架, 下面是mybatis官网给出的 mybatis在maven中央仓库的坐标原文 详情见连接:https://c ...

  7. time_t转换为DateTime

    最近解析文华财经的日线数据. 取得的第一个字段是日期,为time_t格式(long)的. 因为是用C#来写解析程序,所以要转换为DateTime的. time_t是世界时间,要转换为本地时间,所以要加 ...

  8. js奇葩错误 字符串传递问题

    第一种方式function hello(){    var name="he";    var content="<input type=button value= ...

  9. GitHub托管项目步骤

    1.打开Git Shell ,进入你要托管的项目目录里.然后输入git init ,该项目下就会多一个.git文件夹 2.点击add,然后再path里面输入你项目的,git文件夹目录地址.如下: 3. ...

  10. BZOJ 1051: [HAOI2006]受欢迎的牛 缩点

    1051: [HAOI2006]受欢迎的牛 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/ ...