日期:2014-05-16  浏览次数:20367 次

分享福州网(fuzhou99.com)论坛的绝对定位浮动导航条+返回顶部 JS效果

分享福州网论坛fuzhou99.com帖子页面的绝对定位浮动导航条+返回顶部的JS效果,点击导航条栏目会出现伸缩展开隐藏层特效,当滚动滚动条时”返回顶部“隐藏按钮就会出现,还有一些其他的特效功能,这边不多说了,如果需要可以自己复制代码试一下,或者访问www.fuzhou99.com的帖子或列表页面查看演示。

<!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>无标题文档</title>
<style type="text/css">
body{ background-color:#bbac85;}
ul,li{ margin:0px; padding:0px; list-style:none;}
.navbox{ width:95px; height:auto;z-index:99; left:2px; bottom:5px;POSITION:fixed;_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop); font-family: "宋体";}
.mj_nav{ width:93px; height:auto; border:1px solid #806f5f; background-color:#f3f3f3; -webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px; padding-bottom:15px;}
.mj_nav_bt{ width:93px; height:30px; background-color:#806f5f; font-size:14px; font-weight:bold; line-height:30px; text-align:center; color:#fde399; margin-bottom:10px;}
.mj_nav_list{ width:83px; height:auto; padding:0px 5px;}
.nav_span{ display:block; width:68px; padding-left:15px; height:24px; line-height:24px; background-image:url(http://www.fuzhou99.com/img/mjnav.gif); background-repeat:no-repeat; background-position:5px 8px; color:#594d42; font-size:14px; cursor: pointer;}
.mj_sn{ background-position:5px -12px;}
.mj_nav_list ul{ width:68px; height:auto; padding:0px 0px 15px 15px; display:none;}
.mj_nav_list li{ width:68px; height:24px; line-height:24px; font-size:14px; overflow:hidden;}
.mj_nav_list li a{ color:#0a57b7; text-decoration: underline;}
.mj_nav_list li a:hover{ color: #FF6600;}
.guanbi,.gotop{ width:93px; height:30px; line-height:30px; border:1px solid #806f5f; background-color:#f3f3f3; -webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px; text-align:center; font-size:14px; color:#594d42; margin-top:3px; cursor: pointer;}
.gotop{ display:none;}

.zhangkai{ width:20px; height:auto; padding:10px 5px; line-height:20px; font-size:14px; text-align:center;-webkit-border-radius:0px 5px 5px 0px;-moz-border-radius:0px 5px 5px 0px;border-radius:0px 5px 5px 0px; border:1px solid #806f5f; background-color:#f3f3f3; POSITION:fixed;_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop); z-index:100; left:0px; bottom:150px; display:none; cursor: pointer; color:#594d42;}
.xx{ height:1000px;}
</style>

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
	  $(document).ready(function(){
			$(".mj_nav_list span").click(function(){
			    $(".mj_nav_list span").not($(this)).removeClass("mj_sn");
				$(this).toggleClass("mj_sn");
				$(".mj_nav_list ul").not($(this).next()).slideUp();
				$(this).next().slideToggle(500);
				//$(this).next().toggle();
			});
			$(window).scroll(function(){
			   if ( $(window).scrollTop() > 50 ){
                                $(".gotop").fadeIn(800);
                        } else {
                                $(".gotop").fadeOut(500);
                        };
			});
			$(".gotop").click(function(){
			    $(window).scrollTop(0);
			});
			$(".guanbi").click(function(