/**
;(function($){
> pos = el.css("position");
$(window).scroll(function() {
> if (scrolls > top) {
if (window.XMLHttpRequest) {
el.css({
position: "fixed",
top: 0
});
} else {
el.css({
top: scrolls
});
}
}else {
el.css({
position: "absolute",
top: top
});
}
});
}
})(Zepto)
*top、scrollTop实现页面局部位置固定。
*原理:当页面发生滚动,使得element的top值等于页面滚动的scrollTop值。调用时只需 >Gecko内核。
**/;(function($){
> pos = el.css("position");
$(window).scroll(function() {
> if (scrolls > top) {
if (window.XMLHttpRequest) {
el.css({
position: "fixed",
top: 0
});
} else {
el.css({
top: scrolls
});
}
}else {
el.css({
position: "absolute",
top: top
});
}
});
}
})(Zepto)
另种实现页面元素位置固定的方法,使用iscroll。