zl程序教程

您现在的位置是:首页 >  前端

当前栏目

jQuery模拟超链接点击效果代码

jQuery模拟代码 效果 点击 超链接
2023-06-13 09:14:50 时间
复制代码代码如下:

<styletype="text/css">
.divFrame{
width:260px;border:1pxsolid#666;font-size:10pt;
}
.divTitle{
background-color:#eee;padding:5px;
}
.divContent{
padding:5px;display:none;
}
.divCurrColor{
background-color:red;
}
</style>
<scriptsrc="jQuery/jquery-1.9.1.js"></script>
<scripttype="text/javascript">
$(function(){
$(".divTitle").click(function(){
$(this).addClass("divCurrColor").next(".divContent").css("display","block");
})
})
</script>
</head>
<body>
<divclass="divFrame">
<divclass="divTitle">主题</div>
<divclass="divContent">
<ahref="#">链接一</a><br/>
<ahref="#">链接二</a><br/>
<ahref="#">链接三</a>
</div>
</div>
</body>