Detect When A Position: Fixed; Element Crosses Over Another Element
I'm wonder if its is possible to to detect when an element with the css property position: fixed; crosses over another element while scrolling. My goal is to prevent a fixed posit
Solution 1:
$(window).scroll(function () {
if ($(".fixedposition").offset().top < ($(".footer").offset().top - 30)) {
$(".fixedposition").css("top", "30px");
$(".fixedposition").css("display", "block");
} else {
$(".fixedposition").css("display", "none");
}
});
see fiddle here: http://jsfiddle.net/flish/T6x4R/
Of course you should probably do something else other than set display:none;
for your fixed div
Post a Comment for "Detect When A Position: Fixed; Element Crosses Over Another Element"