Reputation: 1651
Do you have any idea why jQuery cycle plugin breaks backgorund image centering when sliding images? (without the plugin activated it works okay)
Here is a demo of my page (try to resize the window or zoom out and see what I mean - the background image gets cropped)
Upvotes: 1
Views: 928
Reputation: 1550
The cycle plugin sets the width of the divs you are cycling on load, and doesn't account for a resize. Cycle has a destroy method. You should be able to call destroy on cycle and recreate it on a window resize event.
http://jquery.malsup.com/cycle/options.html
$(window).resize(function() {
$('#home #background').cycle('destroy');
$('#home #background').cycle({
random: 1
});
});
Upvotes: 2
Reputation: 2354
Adding this style fixes it:
#background div { width: 100% !important }
Upvotes: 1