【问题标题】:Windows 8 IE11 bug scroll with div in position fixedWindows 8 IE11 错误滚动,div 位置固定
【发布时间】:2014-10-11 08:17:35
【问题描述】:

我的新网站有问题。我有一个 div 用作“页面顶部的按钮”。

当我用滚轮鼠标向下滚动时,div 出现但它的位置向右改变(并出现一个滚动条)。我只有 ie 11 才有这个问题...

奇怪...还是不奇怪,我不知道,我已经搜索了几天了,但我什么也没找到。

我的 CSS:

    #btn_up
{
display: block;
width: 100px;
height: 100px;
background-image: url(../img/pagetop.svg); background-repeat: no-repeat;
position: fixed;
bottom: 15px;
right: 25px;
z-index: 1000;
cursor: pointer;
display:none;
}

还有我的javascript:

$(document).ready(function(){

    $(window).scroll(function(){
        if ($(this).scrollTop() > 100) {
            $('#btn_up').fadeIn();
        } else {
            $('#btn_up').fadeOut();
        }
    });

    $('#btn_up').click(function(){
        $('html, body').animate({scrollTop : 0},800);
        return false;
    });
});

我错过了什么???

【问题讨论】:

  • 来吧伙计们,我不着急但不知道会杀了我!

标签: scroll fixed internet-explorer-11


【解决方案1】:

我已经使用您的代码创建了一个快速的jsFiddle 来重现该问题,但在 IE11/win7 以及 FF 和 Chrome 中似乎一切正常。您能否使用我的代码检查您的问题,如果缺少某些内容可以更新源代码以查看问题?

我只替换了这部分:

background-image: url(../img/pagetop.svg); background-repeat: no-repeat;

与:

background-color:red;

您能解释一下“div 将其位置向右移动”的意思吗?

据我所知 - 由于“right: 25px;”,div 显示在页面右侧在“#btn_up”选择器中指定。我想这不是你的主要问题,是吗?

【讨论】:

  • 你好。那么我该如何解释这个...?嗯... div 出现,当我使用滚动条时它向右移动!所以来了一个我通常没有的水平滚动条(谁会长大)。这显然只是一个 IE/win8 问题!
猜你喜欢
  • 2015-12-30
  • 2015-05-04
  • 2016-12-01
  • 1970-01-01
  • 2014-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-19
相关资源
最近更新 更多