在Windows Phone 8上的IE 10上滚动时网页闪烁

时间:2014-08-14 06:03:04

标签: jquery css windows-phone-8 internet-explorer-10 windows-phone-8.1

我正在移动网站上工作,面对这种奇怪的闪烁/摇晃,同时在我的Windows Phone 8上的IE10中滚动我的网页。我使用以下css作为包含我的网页的容器:

position:fixed;
top:0;
left:0;
overflow-y:scroll;
-ms-scroll-snap-type: proximity;
-ms-scroll-snap-points-y: snapInterval(0%, 100%);
-ms-overflow-style: -ms-autohiding-scrollbar;
-webkit-overflow-scrolling: touch;
-ms-touch-action: manipulation;
-ms-user-select: none;
z-index:0;

请建议任何其他方法。

更新

在使用IE11的Windows Phone 8.1中观察到相同的情况

更新2:

HTML:

<body onunload="">
    <div class="popupBox">
        <div class="popupContent">
        </div>
        <div class="clear">
        </div>
        <div class="buttonContainer">
            <a class="closePopup" id="btnClosePopup" href="#">Ok</a> <a class="closePopup margLeft02"
                id="btnCancelConfirmBox" style="display: none;">Cancel</a>
            <div class="clear">
            </div>
        </div>
    </div>
    <div class="body">
        <div class="header">
            <a href="#" class="vault_navOpener">
                <img src="menu_button.png" alt=""></a>
            <div class="width87">
                <h1 class="logo">
                    <a href="#samplelink" id="IdHome">
                        <img src="logo.jpg" alt=""></a>
                </h1>
                <div class="vip_half">
                    <span class="vip_level">
                        <label id="lblVIPLevel">
                            4</label>
                    </span><span id="firstName">Hello Nishaa</span>
                    <div class="clear">
                    </div>
                    <a id="NotTo" class="npd_logout">Log Out</a>
                    <div class="clear">
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
        <div>
            <h2>
                SweepLand<sup>®</sup></h2>
            <div class="main">
                <ul class="points">
                    <li><span class="width70"><span id="a">Points Available:</span></span> <span id="b"
                        class="width30">421</span>
                        <div class="clear">
                        </div>
                    </li>
                    <li><span class="width70"><span id="c">SweepLand Points in Play:</span></span> <span
                        id="c1" class="width30">4</span>
                        <div class="clear">
                        </div>
                    </li>
                    <li><span class="width70"><span id="d">BidLand Points in Play:</span></span> <span
                        id="d1" class="width30">163</span>
                        <div class="clear">
                        </div>
                    </li>
                    <li><span class="width70"><span id="e">Total Points:</span></span> <span id="f" class="width30">
                        588</span>
                        <div class="clear">
                        </div>
                    </li>
                </ul>
                <div class="clear bdr">
                </div>
                <h3>
                    <span id="ContentPlaceHolder1_lblFeaturedPrizes">Featured Prizes</span>
                </h3>
                <div class="featured">
                    <ul class="prizes" id="featured_prizes">
                        <li><a href="#samplelink">
                            <img src="6883.jpg" alt="" onerror="ShowImage(this);">
                        </a>
                            <h4>
                                <a href="#samplelink" class="blue">TestFeaturedSweep_25062014</a>
                            </h4>
                            <span class="width60 clear">5 Prizes</span> <span class="width60">Enter By:</span>
                            <span class="width40">28/08/14</span> <span class="width60 s_points">Points Entered:</span>
                            <span class="width40 s_points_value">
                                <input id="hdnMinFPoints0" value="0" type="hidden">
                                <label id="lblFPoints0">
                                    2</label>
                                <input id="txtFPoints0" value="2" type="text"></span>
                            <div class="clear">
                            </div>
                            <div>
                                <a class="button_bid" id="btnFEdit0">Edit Points</a>
                            </div>
                            <div class="clear">
                            </div>
                        </li>
                        <li><a href="#samplelink">
                            <img src="6883.jpg" alt="">
                        </a>
                            <h4>
                                <a href="#samplelink" class="blue">TestFeaturedSweep_25062014</a>
                            </h4>
                            <span class="width60 clear">5 Prizes</span> <span class="width60">Enter By:</span>
                            <span class="width40">28/08/14</span> <span class="width60 s_points">Points Entered:</span>
                            <span class="width40 s_points_value">
                                <input id="Hidden1" value="0" type="hidden">
                                <label id="Label1">
                                    2</label>
                                <input id="Text1" value="2" type="text"></span>
                            <div class="clear">
                            </div>
                            <div>
                                <a class="button_bid" id="A1">Edit Points</a>
                            </div>
                            <div class="clear">
                            </div>
                        </li>
                        <li><a href="#samplelink">
                            <img src="6883.jpg" alt="" onerror="ShowImage(this);">
                        </a>
                            <h4>
                                <a href="#samplelink" class="blue">TestFeaturedSweep_25062014</a>
                            </h4>
                            <span class="width60 clear">5 Prizes</span> <span class="width60">Enter By:</span>
                            <span class="width40">28/08/14</span> <span class="width60 s_points">Points Entered:</span>
                            <span class="width40 s_points_value">
                                <input id="Hidden2" value="0" type="hidden">
                                <label id="Label2">
                                    2</label>
                                <input id="Text2" value="2" type="text"></span>
                            <div class="clear">
                            </div>
                            <div>
                                <a class="button_bid" id="A2">Edit Points</a>
                            </div>
                            <div class="clear">
                            </div>
                        </li>
                    </ul>
                    <div class="clear">
                    </div>
                </div>
                <div class="clear bdr">
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
        <div class="content_footer">
            <div class="footer">
                <p class="copyright">
                    ©2014
                </p>
                <!-- Footer links here -->
                <ul style="width: 257px;" class="footerList">
                    <li><a href="#sampleLink" id="m"><span id="m1">About Us</span> </a></li>
                    <li><a href="#sampleLink" id="n"><span id="n1">Join</span> </a></li>
                    <li><a href="#sampleLink" id="o"><span id="o1">Privacy Policy</span></a></li>
                    <li class="noBdr"><a href="#sampleLink" id="p"><span id="p1">Terms of Use</span> </a>
                    </li>
                    <li class="clear noBdr"></li>
                </ul>
                <div class="clear margBt01">
                </div>
                <ul style="width: 203px;" class="footerList">
                    <li><a href="#sampleLink" id="q"><span id="q1">Security</span></a></li>
                    <li><a href="#sampleLink" id="r"><span id="r1">Unsubscribe</span></a></li>
                    <li class="noBdr"><a href="#sampleLink" id="s"><span id="s1">Contact Us</span></a></li>
                    <li class="clear noBdr"></li>
                </ul>
                <div class="clear margBt01">
                </div>
                <!-- Footer icons here -->
                <a href="#sampleLink" id="t">
                    <img class="left" src="group-logo.png" alt=""></a> <a href="#sampleLink" id="trust">
                        <img class="right" src="mPrizeBoard.aspx_files/truste-logo-new.png" alt=""></a>
                <div class="clear">
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="overlay">
    </div>
</body>

包含该页面的.body div的CSS如下:

.body
{
    position:absolute;
    top:0;
    left:0;
    overflow-y:hidden;
    opacity:0;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    -webkit-overflow-scrolling: touch;
    -ms-touch-action: pan-y;
    -ms-user-select: none;
    z-index:0;

    -webkit-transition:opacity 1s ease-in-out;
    -moz-transition:opacity 1s ease-in-out;
    -ms-transition:opacity 1s ease-in-out;
    -o-transition:opacity 1s ease-in-out;
}
.body > *
{
    -webkit-transform: translateZ(0px);
    -webkit-text-size-adjust: 100%;
}

注意: 这是为了指定.body div动态获取其高度和宽度,它总是等于窗口的高度和宽度。

1 个答案:

答案 0 :(得分:1)

我感到惊讶的是它以它的方式闪烁,但这种效果可能是通过使用position:fixed来创建的。这将使得因为固定告诉元素相对于浏览器保持在适当的位置,因此它可以用于创建静态导航栏等。看不到你的HTML,很难确切地说明为什么会发生这种情况,但可能是浏览器在渲染固定到屏幕上的元素时出现问题。

我已设法复制您的问题,但找不到使用固定位置的替代方法。

这样看,当你滚动时,你正在告诉页面向上或向下移动,但是使用position:fixed来抵消这可能导致冲突。据我所知,所有浏览器在使用您使用的CSS滚动时都会遇到小闪烁,但是它太小而无法注意到,而且手机中的GPU速度慢,以及您创建的冲突会使这种情况放大。

希望这会有所帮助:)

编辑:我找到了另一个可行的解决方案,尝试将overflow:auto添加到此CSS影响的元素。我不能告诉你这是否会起作用,因为你没有包含和HTML,但它值得一试。 (这是在https://stackoverflow.com/questions/1166816/firefox-3-5-fixed-position-scrolling-annoying-flicker发现的,这是不一样的,但是一个相似的问题)