jQuery Cycle plugin IE6/7 issues

Posted by Aaron Moodie on Stack Overflow See other posts from Stack Overflow or by Aaron Moodie
Published on 2010-03-29T07:46:21Z Indexed on 2010/03/29 8:33 UTC
Read the original article Hit count: 588

I've implemented a slideshow using the Cycle plugin, which is working in all browsers except IE6&7, where the images just show up in a list, and the #page_copy div is not hiding. I've been going through the code all day without any luck, and not exactly sure how or what I should be looking for.

What would be the best way to go about debugging this issue? I know that the #page_copy div is hiding when I remove the rest of the code, and I've tried the reverse (which had no result)

<script type="text/javascript" charset="utf-8">
        jQuery.fn.fadeToggle = function(speed, easing, callback) { 
            return this.animate({opacity: 'toggle'}, speed, easing, callback); 
        };


        $(document).ready(function() {
            $('#page_copy').hide();
            $('a#info_close_button').click(function() {
                $('#page_copy').fadeOut(200);
                return false;
            });
            $('a#info_button').click(function() {
                $('#page_copy').fadeToggle(200);
                return false;
            });
        });


        $(window).load(function() {
            // vertically center single image
            var $image_cnt = $("#images > img").size();
            if($image_cnt < 2) {
                var $single_img = $("#images").children(':first-child');
                var h = $single_img.height();
                $single_img.css({
                    marginTop: (620 - h) / 2,
                });
                $(".next").css("display","none");
                $(".prev").css("display","none");
            }
        });


        // wait until images have loaded before starting cycle
        $(window).load(function() {
            // front image rotator
            $('#images').cycle({ 
                fx: 'fade',
                speed:  300, 
                next:   '.next', 
                prev:   '.prev',
                containerResize: 0,
                timeout:  0, 
                delay:   -2000,
                before: onBefore
            });

        }); 

        // hide all but the first image when page loads
        $(document).ready(function() {
            $('#images img:gt(0)').hide();
        });

        // callback fired when each slide transition begins
        function onBefore(curr,next,opts) {
            var $slide = $(next);
            var w = $slide.width();
            var h = $slide.height();
            $slide.css({
                marginTop: (620 - h) / 2,
                marginLeft: (650 - w) / 2
            });
        };
    </script>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery