Opera 中使用固定位置和文本阴影缓慢滚动(11)
我对所有 p 和 headline 标签使用文本阴影(2px 白色发光以提高可读性),一切正常,直到页面滚动并且 JavaScript 更改一个元素上的绝对定位固定 - 我想保持可见。
除了改变歌剧风格之外,还有什么办法可以让其流畅滚动呢?溢出:自动在这种情况下不起作用...
谢谢
I am using text-shadow for all p and headline tags (2px white glow for better readability), everything works fine until page is scrolled and javascript changes absolute positioning on one element to fixed - which I want to stay visible.
Is there any way apart of changing style for opera to make it scrolled smoothly? overflow:auto is not working in this case...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在没有看到代码的情况下很难说 100%,但我猜想您设计此页面的样式的方式使得 Opera 在滚动时进行了大量的回流和绘制,并且样式的组合将使这是一个非常昂贵的操作。 (如果能看到 jsfiddle 或获得实际页面的链接就太好了,这也将使就可能的解决方法提出建议变得更简单)。
您可以尝试多种修复方法 - 例如,将您想要在屏幕上显示的元素保持为position:absolute样式,并在滚动事件后将其从JavaScript中移走,或者只是避免在Opera中设置position:fixed,并让元素滚动走以获得更好的滚动性能。
不过,我强烈建议您首先向 Opera 报告错误。为什么?
网络的原因和起源是协作。对于因浏览器错误而苦苦挣扎的沮丧 Web 开发人员来说,这一点可能并不明显(可以理解),但他们有责任在发现问题时帮助浏览器供应商进行改进,从而为推动 Web 向前发展做出贡献。像 Opera 这样的少数浏览器诚然拥有较少的开发和 QA 人员资源,但在某种程度上,来自用户社区和“普通”Web 开发人员的支持弥补了这一点,并使较小的参与者也可以在 Web 生态系统中进行开发。我认为这是网络的优势之一,也是没有任何一家公司能够主宰它的真正原因。
所以请报告您的问题和问题:)
it's hard to say 100% without seeing the code, but I guess that the way you've styled this page makes Opera do a lot of reflowing and painting when it is scrolled, and the combination of styles will make this a very expensive operation. (It would be nice to see a jsfiddle or get a link to the actual page, this would also make it simpler to advice on possible workarounds).
There are various fixes you could try - like keeping the element you want on-screen styled with position:absolute and move it from JavaScript after scroll events, or simply avoid setting position:fixed in Opera and letting the element scroll away for better scroll performance.
However, I'd strongly recommend that you first report a bug to Opera. Why?
The reason and the genesis of the web is collaboration. It may not be obvious to (understandably) frustrated web developers struggling with browser bugs, but they have a responsibility for helping browser vendors improve when they find problems, thereby contributing to moving the web forward. A minority browser like Opera admittedly has less development and QA staff resources, but to some extent support from the user community and "normal" web developers makes up for this and makes it possible also for smaller players to develop in the Web ecosystem. I think that's one of the web's strengths and the real reason why no single corporation has been able to dominate it.
So please report your issues and problems :)
这是 Opera 的问题,而不是您编写代码的任何方式的问题。 Opera 是一个巨大的热气腾腾的一堆东西,几乎没有市场份额,你应该使用其他浏览器。
不幸的是,这基本上就是这里任何人都能告诉你的了。我知道每个人都喜欢他们选择的浏览器,但有些人就是不能很好地处理这些事情。其他示例:JavaScript 引擎较差的浏览器渲染动画不稳定且不稳定等。
This is a problem with Opera, not any way you've written the code. Opera is a gigantic steaming pile of doo-doo with almost no market share, and you should use another browser.
That's basically all anyone could tell you here, unfortunately. I understand that everyone loves their browser of choice but some just don't handle these things well. Other examples: browser with a poor javascript engine rendering animations erratically and jerky, etc.