I\'m trying to detect using javascript and jquery when the window scroll hits the top of a selected element. I think I\'m making progress but still no results:
fiddle:
$(window).scroll(function() { var targetScroll = $('.div').position().top; if($(window).scrollTop() > targetScroll) { alert('hey'); }); // <=== Syntax Error: Closing Parenthese around an if block });