- 时间:2021-10-09 01:25 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:jQuery hover事件简单实现同时绑定2个方法
本文实例讲述了jQuery hover事件简单实现同时绑定2个方法。分享给大家供大家参考,具体如下:
这里将hover事件同时挂2个方法:
1个是悬停的时候执行的,另外一个是离开的时候执行
代码如下:
$(document).ready(function() {
$("#orderedlist li").hover(
function() {$(this).addClass("blue");},
function() {$(this).removeClass("blue");}
);
});
[b]PS:上面的代码小编没有进行格式化处理,这里顺便为大家推荐几款在线代码格式化、美化工具,相信大家在以后的开发过程中会用得到:[/b]
[b]在线JavaScript代码美化、格式化工具:
[/b][url=http://tools.jb51.net/code/js]http://tools.jb51.net/code/js[/url]
[b]JavaScript压缩/格式化/加密工具:
[/b][url=http://tools.jb51.net/code/jscompress]http://tools.jb51.net/code/jscompress[/url]
[b]json代码在线格式化/美化/压缩/编辑/转换工具:
[/b][url=http://tools.jb51.net/code/jsoncodeformat]http://tools.jb51.net/code/jsoncodeformat[/url]
[b]在线JSON代码检验、检验、美化、格式化工具:
[/b][url=http://tools.jb51.net/code/json]http://tools.jb51.net/code/json[/url]
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/93.htm]jquery中Ajax用法总结[/url]》、《[url=http://www.1sucai.cn/Special/539.htm]jQuery表格(table)操作技巧汇总[/url]》、《[url=http://www.1sucai.cn/Special/497.htm]jQuery拖拽特效与技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/451.htm]jQuery扩展技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/430.htm]jQuery常见经典特效汇总[/url]》、《[url=http://www.1sucai.cn/Special/104.htm]jQuery动画与特效用法总结[/url]》、《[url=http://www.1sucai.cn/Special/75.htm]jquery选择器用法总结[/url]》及《[url=http://www.1sucai.cn/Special/200.htm]jQuery常用插件及用法总结[/url]》
希望本文所述对大家jQuery程序设计有所帮助。