I have a page running jQuery loop with malsup awesome. I am using the latest version (2.99) and Safari 5.0.5. I have not met the following problem before, and this seems a bit strange.
Problem
Sometimes, when a page loads, the .slides element is only 654 pixels wide. I set the value to 960px in the css file. But when I use JavaScript to get the width of the .slides element, it says that it has a width of 1271 pixels. A? This problem sometimes happens in Firefox (3.6.16), but not where almost as much as Safari. Oddly enough, I cannot reproduce this error in IE8.
My code is valid only for W3C (except for 3 border radius calls). Perhaps there is a restriction on using a form element as a loop container? Does Safari not work?
JS:
$(document).ready(function(){ var sw = $('.slides').width(); $('.slides').cycle({ fx: 'scrollHorz', nowrap: 0, fit: 1, timeout: 0, next: '.next', prev: '.prev', speed: 250 }); if (sw != 960){ $('.slides').css('width','960px');
CSS:
#content{ float:left; width:100%; } .wrapme{ width:960px; height:auto; margin:0 auto; } .slides{ float:left; width:960px; height:auto; overflow:auto; }
You can (hopefully) see the βerrorβ in action here . I would like to know if this does not happen for anyone else (you may have to press F5 several times).
I would like to fix this annoying little mistake. The sequence of setting the width of the container after the cycle adjusted it (with the wrong width, no doubt) only eliminates half the problem. As you move on to the next slide, it will reduce the width. The next slide, it reduces it again. Thus, after slide 3, it skips all content up to 240 pixels wide.
I suppose a solution to this would be to force everyone to use Firefox / IE (it will be on the corporate intranet).
Thanks for any help and understanding in advance!
Dan
EDIT updated link: https://necms.com.au/cycle_oddities.php