Reputation: 41
I am attempting to fire a jQuery function when the window scrolls using the following code:
$(window).scroll(function(){
However, when I set a body height of 100% (needed for formatting on the site), the scroll function does not fire. The body height is set to 100% so that the background image fills the entire browser window.
Is there any way that I can have the scroll function fired when scrolling, or an alternate function or alternate code to have a background image stretch the entire page?
Thank you
Edit (My solution):
This was a bit of a weird question, as it had strict conditions - ie) the body heights, and other coding I've put in whilst playing around.
However I found that I had
overflow:auto;
set on a parent div just inside the body.
The solution was to remove the overflow and add a
position:relative;
to the div surrounding all the content.
This probably won't apply to anyone else, however I thought I'd post the solution just incase!
Thanks for your help!
Cheers Alex
Upvotes: 4
Views: 2020
Reputation: 1258
You could specify background size like this:
body{
background-image: url('http://images.google.com/intl/en_ALL/images/srpr/logo11w.png');
background-size:100%;
background-repeat:no-repeat;
}
and it will fill the entire browser window
Upvotes: 1