This script runs well with jQuery-1.3.2.min.js but doesn't run with jQuery-1.6.2.min.js .
Can anyone help me to fix this?
function moveScroller() {
var a = function () {
var b = $(window).scrollTop();
var d = $("#scroller-anchor").offset({
scrol开发者_StackOverflow中文版l: false
}).top;
var c = $("#scroller");
if (b > d) {
c.css({
position: "fixed",
top: "0px"
})
} else {
if (b <= d) {
c.css({
position: "relative",
top: ""
})
}
}
};
$(window).scroll(a);
a()
}
$(function () {
moveScroller();
});
offset()
switched to taking coordinates as a parameter with jQuery version 1.4.
Change:
var d = $("#scroller-anchor").offset({scroll:false}).top;
To:
var d = $("#scroller-anchor").offset().top;
We can't help much with the rest of the code without seeing the HTML and CSS that goes with it.
What is:
.offset({scroll:false})
The offset function does not take a scroll parameter.
精彩评论