教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 Jquery事件的连接使用示例

Jquery事件的连接使用示例

发布时间:2014-01-23   编辑:jiaochengji.com
本文以展开图片和收缩图片为例为大家介绍下Jquery事件的连接的使用方法,感兴趣的朋友可以参考下哈,希望对大家有所帮助
复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jquery事件的连接</title>
<style type="text/css">
.divFrame{ width:260px; border:1px solid #666; font-size:10px }
.divTitle{ background-color:#eee; padding:5px}
.divContent{ padding:5px; display:none}
.divCurrColor{ background-color:Red}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('.divTitle').click(function () {
$('.divTitle').addClass('divCurrColor')
.next('.divContent').css('display','block')
})
})
</script>
</head>
<body>
<div class="divFrame">
<div class="divTitle">主题</div>
<div class="divContent">
<a href="图片设置.htm">图片设置</a><br />
<a href="展开图片和收缩图片.htm">展开图片和收缩图片</a><br />
</div>
</div>
</body>
</html>

实现以下效果
 
点击它,会显示如下效果

您可能感兴趣的文章:
JQuery如何触发元素事件
jQuery学习笔记之jQuery的事件
Jquery事件的连接使用示例
jQuery代码优化 事件委托篇
ASP 3.0高级编程(三十八)
jQuery注册事件实例代码
微插件推荐系列:jquery.mousewheel
jQuery live( type, fn ) 委派事件实现
jQuery实用技巧第1/2页
jQuery技巧大放送 学习jquery的朋友可以看下

关键词: 事件  连接   
[关闭]
~ ~