在iOS 8中滚动的背景图像闪烁问题

时间:2015-02-11 05:28:55

标签: javascript jquery html ios css

我正在使用Supersized jquery滑块插件来获得整页背景滑块的淡入效果&获得一些高度滚动页面。

在桌面中,此滑块正常工作,但当我在iOS 8 iPad设备中检查时,发现背景图像在滚动时闪烁。

我搜索了这个问题&发现这个问题是由于位置固定和滚动。在iOS 8的On Scroll中,地址栏消失,使背景图像闪烁。

JQuery插件实现:

jQuery(function($){
            $.supersized({
                // Functionality
                slide_interval          :  2000,        // Length between transitions
                transition              :  1,   // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                transition_speed    :  4000,    // Speed of transition

                // Components                           
                slide_links     :  'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
                slides          :  [            // Slideshow Images
                                                                                    {image : 'images/1.jpg'},
                                                                                    {image : 'images/2.jpg'},
                                                                                    {image : 'images/3.jpg'},
                                                                                    {image : 'images/4.jpg'},
                                                                                ]
            });
                    });

CSS实施:

    #supersized-loader { position:absolute; top:50%; left:50%; z-index:0; width:60px; height:60px; margin:-30px 0 0 -30px; text-indent:-999em;  }

    #supersized {  display:block; position:fixed; left:0; top:0; overflow:hidden; z-index:-999; height:100%; width:100%; }
        #supersized img { width:auto; height:auto; position:relative; display:none; outline:none; border:none; }
            #supersized.speed img { -ms-interpolation-mode:nearest-neighbor; image-rendering: -moz-crisp-edges; }   /*Speed*/
            #supersized.quality img { -ms-interpolation-mode:bicubic; image-rendering: optimizeQuality; }           /*Quality*/

        #supersized li { display:block; list-style:none; z-index:-30; position:fixed; overflow:hidden; top:0; left:0; width:100%; height:100%; background:#111; }
        #supersized a { width:100%; height:100%; display:block; }
            #supersized li.prevslide { z-index:-20; }
            #supersized li.activeslide { z-index:-10; }
li.image-loading {   width:100%; height:100%; }
                #supersized li.image-loading img{ visibility:hidden; }
            #supersized li.prevslide img, #supersized li.activeslide img{ display:inline; }

1 个答案:

答案 0 :(得分:0)

尝试为iphone / ipad设备实现此功能..

/* iPad [portrait + landscape] */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
#supersized { margin-left:0;}
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
#supersized { width:110% !important;}
}
/* iPhone [portrait + landscape] */
@media only screen and (max-device-width: 480px) {
#supersized { margin-left:0; }
}

来源:: https://stackoverflow.com/a/10145429/3164682