jQuery页面滚动顶部右侧固定层代码

jQuery页面滚动顶部右侧固定层代码-精品资源网
jQuery页面滚动顶部右侧固定层代码
此内容为免费资源,请登录后查看
0
免费资源

jQuery页面滚动顶部右侧固定层代码

这是一款滑到一定位置固定跟随页面滚动置顶的网页特效,jQuery页面滚动顶部右侧固定层代码。

js代码

<script type=\"text/javascript\" src=\"js/jquery.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function(e) {			
	t = $(\'.fixed\').offset().top;
	mh = $(\'.main\').height();
	fh = $(\'.fixed\').height();
	$(window).scroll(function(e){
		s = $(document).scrollTop();	
		if(s > t - 10){
			$(\'.fixed\').css(\'position\',\'fixed\');
			if(s + fh > mh){
				$(\'.fixed\').css(\'top\',mh-s-fh+\'px\');	
			}				
		}else{
			$(\'.fixed\').css(\'position\',\'\');
		}
	})
});
</script>

© 版权声明
THE END
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容