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;
})();
CSS skills: 2) change hover dynamically by js的更多相关文章
- CSS skills: 5) jquery hover(over,out)
$(":div[name=div_edit]").each(function() { $(this).hover(function() { $(this).find("& ...
- 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 ...
- 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 ...
- Effective前端1:能使用html/css解决的问题就不要使用JS
div{display:table-cell;vertical-align:middle}#crayon-theme-info .content *{float:left}#crayon-theme- ...
- [转]能用HTML/CSS解决的问题就不要使用JS
原文链接:http://www.codeceo.com/article/html-css-not-js.html 为什么说能使用html/css解决的问题就不要使用JS呢?两个字,因为简单.简单就意味 ...
- 能使用html/css解决的问题就不要使用JS
为什么说能使用html/css解决的问题就不要使用JS呢?两个字,因为简单.简单就意味着更快的开发速度,更小的维护成本,同时往往具有更好的体验,下面介绍几个实例. 1. 导航高亮 导航高亮是一种很常见 ...
- 优化 html 标签 为何能用HTML/CSS解决的问题就不要使用JS?
优化 html 标签 2018年05月11日 08:56:24 阅读数:19 有些人写页面会走向一个极端,几乎页面所有的标签都用div,究其原因,用div有很多好处,一个是div没有默认样式,不会有m ...
- sublime格式化js、css、html的通用插件-html js css pretty
sublime格式化js.css.html的通用插件-html js css pretty: 这个插件可以格式化基本上所有js html css文件,包括写在html中的js代码 ,可以在packag ...
- 鼠标悬浮控制元素隐藏与显示 - css中鼠标的hover状态
需求:当鼠标移动到一个元素A身上时,另外一个元素B显示. 实现原理: A元素与B元素有一个相同的父级. B元素默认隐藏,A元素默认显示. 当鼠标移动到A元素身上时,也可以看做是移动到了A元素的父级身上 ...
随机推荐
- java类加载与初始化
第一段: class A{ public A(){ this.list(); } public void list(){ System.out.println("in a list..&qu ...
- 15个顶级Java多线程面试题及答案
1)现在有T1.T2.T3三个线程,你怎样保证T2在T1执行完后执行,T3在T2执行完后执行? 这个线程问题通常会在第一轮或电话面试阶段被问到,目的是检测你对”join”方法是否熟悉.这个多线程问题比 ...
- 第二百三十七天 how can I 坚持
最近好像迷上看小说了,<灵域>,而且也感觉会看小说了. 话说,今天好冷啊,真怕在路上冻着就冻萌了,寒风赤骨啊. 好想买个帽子.好想让送个帽子. 睡觉.
- Android实例-程序切换到后台及从后台切换到前台
相关资料: http://www.delphitop.com/html/Android/2933.html 程序包下载: http://download.csdn.net/detail/zhujian ...
- Android实例-获取程序版本号(XE10+小米2)
相关资料: 383675978群号 实例源码: unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, Sy ...
- Gym 100507H Pair: normal and paranormal (贪心)
Pair: normal and paranormal 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/H Description ...
- UVaLive 7363 A Rational Sequence (二叉树)
题意:给定一个二叉树,并对每一个进行编号和规定,现在给你一个值,问你是第几个. 析:这个题,我想了好久才想出来,这个真是数据结构练的太差了,不够扎实,这个题,应该从下向上推,如果分子大于分母,那么这个 ...
- android ipc通信机制之二序列化接口和Binder
IPC的一些基本概念,Serializable接口,Parcelable接口,以及Binder.此核心为最后的IBookManager.java类!!! Serializable接口,Parcelab ...
- Python3爬取百度百科(配合PHP)
用PHP写了一个网页,可以获取百度百科词条.源代码已分享至github:https://github.com/1049451037/xiaobaike/tree/master 那么通过Python来爬 ...
- WinFrom界面框架之WeifenLuo.WinFormsUI.Docking + OutLookBar
本文转载:http://www.cnblogs.com/luomingui/p/3329763.html WeifenLuo.WinFormsUI.Docking + OutLookBar结合使用的效 ...