码迷,mamicode.com
首页 > Web开发 > 详细

JS插件汇总

时间:2015-01-09 12:35:05      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:插件   js   jquery   

//jQ滚动固定插件
<span style="white-space:pre">		</span>(function($) {
			$.fn.addfix = function(option) {
				var fixtop = $(this).offset().top;
				var fixleft = $(this).offset().left;
				var fixwidth = $(this).width();
				var $that = $(this);
				$(window).scroll(function() {
					wtop = $(window).scrollTop();
					if (wtop >= fixtop) {
						//$that.addClass("navfix").css({"left":fixleft+"px","width":fixwidth+"px",});
						$that.addClass("navfix");
					} else {
						$that.removeClass("navfix");
					}
				});
			};
		})(jQuery);
<style>
		.navfix {
			position: fixed;
			top: 0;
			z-index: 9999;
			/*width: 100%;*/
		}
		body {
			/*padding-top: 100px;*/
		}
	</style>
$("#telid").addfix();//调用



JS插件汇总

标签:插件   js   jquery   

原文地址:http://blog.csdn.net/dongzhout/article/details/42552873

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!