1、实例代码:
<!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> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>jquery事件</title> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <style type="text/css"> body{ font-family:微软雅黑; font-size:12px; font-stretch:normal; background-color:!important; width:400px; height:auto; } .total{ border:#00ff00 solid 1px; font-size:12px; } .module{ padding:6px; font-size:14px; font-weight:bolder; background-color:#fc6; } .content{ padding:8px; font-size:12px; font-family:微软雅黑; text-align:center; display:none; } .open{ background-color:#0000ff; } </style> <script type="text/javascript"> $(function(){ $(".content").html("你好,欢迎来到脚本之家!"); $(".module").click(function(){ $(this).addclass("open").next(".content").css("display","block"); $(this).css("color","#fffff"); }); }); </script> </head> <body> <p class="total"> <p class="module">模块</p> <p class="content"></p> </p> </body> </html>
2、实例结果:
(1)初始化
(2)点击“模块”
相关推荐:
js实现点击循环切换显示内容的方法
angular实现日程表功能(可添加及隐藏显示内容)详解
angular4中如何显示内容的css样式示例代码
以上就是jquery实现点击显示内容下拉效果的详细内容。
