Question: Why wont the If and the Else both work, when both conditions can be met at different times by scrolling below or above '.fakeheading'? Is the Else-statement overpowering the If-statement?
JQUERY:
$(window).scrollTop(function() {
$('.grid_12').find(function () {
var $header = $(this);
if ($header.offset().top < $(window).Top()) {
$(".fakeheading").css({position:"fixed"})
} else {
$(".fakeheading").css({position:"absolute"})
}
});
});
additional info/thoughts:
Why wont the 'if' statement work, if I have $(".fakeheading").css({position:"absolute"})
in the 'else' statement. Either the If, or the Else is working, but they will not both work together like they should. It's like my code wont obey the if-statement when I have the code that's contained in the else-statement. but if I mess up the else-statement code,(have it be
posssssition:"absolute"
then the if-statement part of my script works fine.