脚本宝典收集整理的这篇文章主要介绍了javascript代码实例教程-JS高级做的导航条。可展开可挂起。可简化。,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。
<head>
<tITle>导航条在项目中的应用</title>
<style tyPE="text/css">
#pFrame
{
width: 500px;
height: 200px;
border: solid 2px #eee;
}
#pHeader
{
width: 500px;
height: 50px;
background-color: #eee;
}
#pMore
{
float:right; padding-top:50px;
}
ul{ list-style-type:none; padding:0px;}
li{ float:left; width:100px; height:30px;}
#sp1
{
float:right; margin-top:0px;
}
#splish
{
font-Size:30px;
font-weight:bold;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
VAR numb = 1;
$('#sp1').click(function () {
/*if (numb % 2 != 0) {
$('#pContent').hide(2000);
$('#sp1').text('展开');
}
else {
$('#pContent').show(2000);
$('#sp1').text('挂起');
}
numb++;*/
//判断#pContent的显示与隐藏状态
if ($('#pContent').is(':visible')) {
$('#pContent').hide(2000);
$('#sp1').text('展开');
}
else {
$('#pContent').show(2000);
$('#sp1').text('挂起');
}
})
$('#pMore').click(function () {
if ($('#pMore a').text() == '简化') {
$('li:gt(3)').hide(2000); //获取ul中第4行以后的li
$('#pMore a').text('更多....');
}
else {
$('li:gt(3)').show(2000);
$('#pMore a').text('简化');
}
})
})
</script>
</head>
<body>
<p id="pFrame">
<p id="pHeader">
<span id="splish">图书类别</span>
<span id="sp1">挂起</span>
</p>
<p id="pContent">
<ul>
<li><a href="#">青春</a></li>
<li><a href="#">少儿</a></li>
<li><a href="#">娱乐</a></li>
<li><a href="#">周刊</a></li>
<li><a href="#">军事</a></li>
<li><a href="#">营养</a></li>
<li><a href="#">健康</a></li>
<li><a href="#">时事</a></li>
<li><a href="#">国际</a></li>
<li><a href="#">英语</a></li>
<li><a href="#">电子</a></li>
<li><a href="#">公务员</a></li>
<li><a href="#">行测</a></li>
<li><a href="#">申论</a></li>
</ul>
<p id="pMore"><a href="#">简化</a></p>
</p>
</p>
</body>
觉得可用,就经常来吧! 脚本宝典 欢迎评论哦! js脚本,巧夺天工,精雕玉琢。小宝典献丑了!
以上是脚本宝典为你收集整理的javascript代码实例教程-JS高级做的导航条。可展开可挂起。可简化。全部内容,希望文章能够帮你解决javascript代码实例教程-JS高级做的导航条。可展开可挂起。可简化。所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。