Jquery 显示/隐藏:在 Internet Explorer 中缓慢隐藏会导致可怕的效果..想法?

发布于 2024-08-29 08:06:30 字数 379 浏览 1 评论 0原文

我实现了 这个 Jquery show/hide 代码,一切正常很好,除了我想隐藏的框,使用慢速 JavaScript 浏览器(IE 6)在加载网页(或至少加载所有 JS)后隐藏。由于页面非常复杂,这需要一段时间,导致显示内容的效果非常糟糕,然后它被隐藏了..太糟糕了..

我确实知道我可以使用 CSS 设置 TO_HIDE_BOX display=none ,然后稍后使用js,但我不知道该怎么做,因为没有启用js的人将无法看到隐藏的内容。

你们有关于如何消除这种可怕影响的想法吗?

I implemented this Jquery show/hide code and everything works fine except that the box that I want to hide, with slow javascript browsers (IE 6) is hidden after the webpage has been loaded (or at least all the JS). And as the page is pretty complex this takes a while resulting in the very bad effect of displaying contents and then it gets hidden.. Awful..

I do know that I can set the TO_HIDE_BOX display=none with CSS and then change it later with js, but I don't what to do that because people without js enabled won't be able to see the hidden contents.

Do you guys have ideas on how to remove this awful effect?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一紙繁鸢 2024-09-05 08:06:30

你可以把 .showDivWithNoJS { display: none; } 在你的 css 和你想要隐藏的元素上的类(你可能想给它一个更短的名称:),然后在页面顶部执行此操作:

<noscript>
  <style type="text/css">.showDivWithNoJS { display: block; }</style>
</noscript>

这会以良好的效果显示你的元素如果他们启用了 JavaScript,如果没有,它会立即显示它们,因为无论如何他们都没有获得显示效果。

You can put .showDivWithNoJS { display: none; } in your css and the class (which you'll probably want to give a shorter name :) on the elements you want hidden, then do this at the top of the page:

<noscript>
  <style type="text/css">.showDivWithNoJS { display: block; }</style>
</noscript>

This shows your elements with a nice effect if they have JavaScript enabled, and if not it shows them immediately, since they're not getting the show effect anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文