首页 > 代码库 > JS插件汇总

JS插件汇总

//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插件汇总