Reputation: 861
I have backstretch initializing once my page is loaded. After that, I have an event method that changes the background image with backstretch. Once the event runs backstretch will no longer resize for any other elements except for the one that has been updated.
Does backstretch have a single event instance for window resizing? If so is there anything I can do to fix this?
Thanks!
Example:
$('body').backstretch('woot.jpg');
$('#menu-home').backstretch('dog.jpg');
$('#menu-about').backstretch('cat.jpg');
$('#menu-contact').backstretch('iguana.jpg');
$('#menu-home').on('click', function(){
$('body').backstretch('dog.jpg');
});
Upvotes: 0
Views: 864
Reputation: 927
There is a resize method which can be called mannually (src):
$('your-selector').backstretch('resize');
Upvotes: 0
Reputation: 1639
I use backstretch in one div that takes all the visible area of the browser, so that you can scroll down and the rest of the page doesn't have the background. To adjust it on windows resize I found no other way than using javascript:
window.onresize = homePageResize;
function homePageResize() {
$('#landingTop').css({ 'height': ($(window).innerHeight()) + 'px' });
}
Upvotes: 0