was working on a anchor point that triggers a divs visibility. There’s no problems if I run it with Jquery 1.3.2 library but when I try with 1.7.1 it’s not recognized. any ideas?
$(function() {
var a = function() {
var windowtop = $(window).scrollTop();
var d = $("#anchor").offset({scroll:false}).top;
var c= $("#flyout");
if (windowtop > d) {
c.css({visibility:"visible"});
} else {
if (windowtop <= d) {
c.css({visibility:"hidden"});
}
}
};
$(window).scroll(a);a()
});
});
dseems to always returnundefined.I suspect your code breaks because of the
{scroll:false}object your are passing as an argument tooffset(). Removing it might solve your problem.Check the jQuery().offset() API;
jQuery(elem).offset()returns an object containing the element’s top and left coordinates. Can be used asjQuery(elem).offset().top;.jQuery(elem).offset({top:20, left:20});sets the new top and left coordinates for the element.