//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();//调用原文地址:http://blog.csdn.net/dongzhout/article/details/42552873