tags:

views:

44

answers:

2

Hello,

do you have any ideas 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)

http://j.mp/czX3DD

+1  A: 

Adding this style fixes it:

#background div { width: 100% !important }
Nick Spiers
Its got something to do with the cycle plugin trying to figure out the width of the container. This CSS will ignore its attempts to change the widths.
Nick Spiers
+1  A: 

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
  }); 
});
hellslam