Hide Div When Window X Position is past 1700px - jQuery
I am working on 开发者_JS百科a single page horizontal scrolling site that is 10,000 px wide and have a fixed position div that I only want to show with-in the first 1700 px of my site. So in other words when the windows x position is at 1700 px or greater I want the div to hide. How can I do this with jQuery? Thanks
Try something like this:
$(document).ready( function() {
$(window).scroll( function() {
if ($(window).scrollLeft() > 1700)
$('#targetDiv').hide();
else
$('#targetDiv').show();
} );
} );
精彩评论