Problem mixing overflow-x, FireFox, and Javascript

a 夏天 提交于 2019-12-12 02:28:01

问题


First of all, this problem only happens in Firefox.

Check this example page to understand the problem: -removed-

Select any page besides home. The window will scroll to page. You can then scroll down using the mouse wheel. This works fine. BUT if you grab the scroll bar on the right with your mouse it will jump back to the "home page" (the top left, first element, which is part of the ENTIRE page/website).

The offending code is:

#content{

overflow-x: hidden; /* <<problem maker */
overflow-y: auto;
width:100%;
background-color:white;
position:relative;
height:400px;
float:left;
min-width: 900px;

}

... if I unhide overflow-x (overflow-x: auto;) everything works properly, but I get an undesired horizontal scroll bar.

I am using the jquery ScrollTo plugin that is animating the position of the div inside #content to create the "sliding" effect. Apparently, because Firefox is "resetting" to the default load position, it doesn't think it should have ever allowed me to "slide" horizontally.

Is this a Firefox bug? Or a bug in the ScrollTo plugin? Or maybe even jQuery?

Any ideas of how to fix this? Workarounds ideas?

Any help is much appreciated! Thanks!


回答1:


Workaround: Hide the scroll bar under another div. Lame, but works in my case.




回答2:


Back in ye old 2005, this was solved as such http://www.htmlcodetutorial.com/help/archive.php/o_t__t_1294__overflow-on-firefox.html



来源:https://stackoverflow.com/questions/3910386/problem-mixing-overflow-x-firefox-and-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!