malsup / cycle

jQuery Cycle Plugin - Slideshow goodness
http://jquery.malsup.com/cycle/
1.19k stars 307 forks source link

Wrong width calculated when init removes scrollbars. #181

Open RalphSleigh opened 8 years ago

RalphSleigh commented 8 years ago

Just figured this out as this is apparently still state of the art slideshow technology in Drupal 8.

Broadly speaking:

1) Initial page includes a slideshow that has 100% page width and a vertical scrollbar.

2) Cycle adjusts the position on slides, this causes a reduction in the container height and removes the vertical scrollbar as it all fits in the window.

3) Reads the slides width and sets that explicitly on the elements as the larger width without the scrollbar.

4) Sets the container size to the size of the largest slide. this re-triggers the vertical scrollbar.

5) We now have a container and slides wider than the page, triggering a horizontal scrollbar.

To fix this, I have moved the calculations done in the reshape section to further up the function before any changes are made to the page. This fixes my case.