Chrome and overflow:hidden issue

我们两清 提交于 2019-12-10 19:12:07

问题


In my javascript I use the jquery animate() function to slide tweets automatically.

Code:

function movefeeds() {
   var element = jQuery("#Feeds");
   var position = element.position();

   if(position.left == 2000){
      element.css("left", "500px");
   } 

   element.animate({ "left": "-=500px" }, "slow");   
}

In every browser to code does exactly what it must do: sliding. But in Chrome it is not sliding always, it is sliding half the time. And even if it slides, left gets really bad values (ie. 584.2132312 instead of 500, 1000 etc.)

Any suggestion would be appreciated :-)

EDIT: Looks like a css issue: chrome (from version 11) seems to have some trouble with overflow:hidden

EDIT 2: See this question


回答1:


Could not find any solution for using overflow:hidden in chrome. So I removed the overflow from my css and put some div's with z-index over the tweets to hide them.

Found my solution in this: Question




回答2:


This may seem like an odd answer, but it's consistent with what I've seen happen in chrome before with animations:

Are you including your javascript after your CSS? Depending on how your page is set up, I've seen Chrome flake out as it's trying to run javascript before CSS styles are loaded, so your animation won't work because it doesn't have the element's position attribute loaded yet.



来源:https://stackoverflow.com/questions/6425460/chrome-and-overflowhidden-issue

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