简体   繁体   English

Internet Explorer Buggy CSS左

[英]Internet Explorer Buggy CSS Left

I have a html page where I want a div to scroll vertically with the page but not horizontally (rest of the content to disappear under it); 我有一个html页面,我希望div与页面垂直滚动而不是水平滚动(其余内容消失在页面下方);

From a previous question I found a good answer to this, however I was wondering if there was a way to fix a small bug. 从上一个问题中我找到了一个很好的答案,但是我想知道是否有一种方法可以修复一个小错误。

http://jsfiddle.net/nkgsqc1o/ http://jsfiddle.net/nkgsqc1o/

When scrolling left using either the scroll bar's arrow or the arrow keys on the keyboard, the green box goes all spazzy trying to keep up. 当使用滚动条的箭头或键盘上的箭头键向左滚动时,绿色框会一直闪烁,试图跟上。 This doesn't occur in Firefox. 在Firefox中不会发生这种情况。

I am wondering if its the jquery code (below) or Internet Explorer itself? 我想知道它的jQuery代码(下面)还是Internet Explorer本身?

$('#Container').scroll(function() {
    $('#Const').css('left', $('#Container').scrollLeft());
});

I have tried playing with jquery's animate but it does much the same. 我试过玩jquery的动画,但效果却差不多。 I have also tried playing with the "smooth scrolling" setting inside Internet Explorer but that didn't help either. 我也尝试过在Internet Explorer中使用“平滑滚动”设置,但这也无济于事。

Please check this fiddle . 请检查这个小提琴 I have removed jquery and simply used CSS. 我删除了jquery并仅使用了CSS。 Hope that helps. 希望能有所帮助。

 div.Container{ height: 300px; border: 2px solid #F00; width: 800px; padding: 3px; overflow: auto; /* POSITION */ position:fixed; z-index : 1; } div.Const{ border: 2px solid #0F0; width: 200px; height: 250px; float:left; position:fixed; overflow-y:hidden; z-index : -1; } div.Main{ border: 2px solid #00F; width: 3000px; height: 200px; margin-left: 220px; top:0px; float:left; z-index : 1; } 
 <div id="Container" class="Container"> <div id="Const" class="Const"> </div> <div id="Main" class="Main"> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM