【发布时间】:2017-02-03 02:55:38
【问题描述】:
欢迎!请帮帮我!该脚本在浏览器 Internet Explorer 中无法正常工作。在滚动过程中,有一个强力的上下拉动方块。怎么修?请帮帮我。非常感谢您的帮助!
$(function() {
var $hor = $("#horizontal");
$("body").css('padding-bottom', $(window).width()*2);
var delta = 0;
$(window).on('scroll', function () {
var top = $(document).scrollTop();
var width = $(window).width();
var lim = $hor.position().top - (delta) - ($(window).height() - $hor.outerHeight()) / 2;
delta = Math.min(Math.max(top - lim, 0), width * 2);
$(".horizontal:first", $hor).css({left : delta});
$(".horizontal:last", $hor).css({left : -(width*2 - delta)});
$("body").css({'padding-top': delta, 'padding-bottom': width*2 - delta});
});
});
p {
height: 500px;
}
#horizontal {
position: relative;
overflow: hidden;
width: 100%;
font-size: 3em;
margin: 0;
padding: 0;
height: 250px;
}
#horizontal .horizontal {
position: absolute;
width: 100%;
left: -100%;
padding: 20px;
}
#horizontal .horizontal .h_blockquote {
position: relative;
width: 100%;
margin: 0 auto;
font-size: 24px;
line-height: 1.3em;
color: #000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>test</p>
<div id="horizontal">
<div class="horizontal">
<div class="h_blockquote">
<div class="h_blockquote_wrap">The script does not work properly in the browser Internet Explorer. The script does not work properly in the browser Internet Explorer.</div>
</div>
</div>
<div class="horizontal">
<div class="h_blockquote">
<div class="h_blockquote_wrap">The script does not work properly in the browser Internet Explorer. The script does not work properly in the browser Internet Explorer.</div>
</div>
</div>
</div>
<p>test</p>
【问题讨论】:
-
我们不知道 “无法正常工作” 的具体含义,也不知道您在哪些版本的 Internet Explorer 中进行了测试
-
在所有版本的 Internet Explorer 浏览器中,当滚动块 #horizontal 并开始整个页面“上下跳跃”。
-
嗨,它是一个旧的错误,但有一个使用 jquery 滚动插件的解决方法,您可以阅读所有相关信息并在此处查看详细信息 github.com/noraesae/perfect-scrollbar/issues/160 并在此处修复 manos.malihu.gr/jquery-custom-content-scroller
-
但是如果你使用侧边栏滚动页面,脚本就可以工作了。
-
没有人用IE了。如果您支持 IE,那么人们会在您的应用程序中使用它,并且更多人使用 IE = 网络尽头。所以不要修复????对于 IE,请 ????
标签: javascript jquery internet-explorer browser scroll