Disappearing images in IE8 jQuery Cycle

[亡魂溺海] 提交于 2019-11-27 16:07:20

I was having this issue also and I traced it back to the CSS rule

img {
  max-width: 100%;
}

Once I removed the above rule (I didn't need it in this case) the images stopped disappearing.

If you want to keep the

max-width: 100%;

then also add

width: auto;

OR remove the explicit width and height attributes from the HTML

OR put the image in a non-floated container

OR assign the container a specific width.

There is a pretty good article on this bug here:

http://www.456bereastreet.com/archive/201202/using_max-width_on_images_can_make_them_disappear_in_ie8/

It sounds like the images are still loading.

Try this...

$(window).load(function() {
    $('#product-images, #front-slides').cycle({
        timeout: '7000',
        next: '#next',
        prev: '#prev',
        pager: '#pager',
        pagerAnchorBuilder: function(idx, el) {
                return '<a href="#"></a>';
            }
    });
 });

window.load() will fire after the DOM and the page's images have loaded, where document.ready() only fires after the DOM has loaded.

Change

img {
    max-width: 100%;
}

to

img {
    max-width: auto;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!