开发者

Script not working when migrated from jQuery 1.3.2 to 1.6.2

开发者 https://www.devze.com 2023-03-23 11:13 出处:网络
This script runs well with jQuery-1.3.2.min.jsbut doesn\'t run with jQuery-1.6.2.min.js . Can anyone help me to fix this?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消