如何在内容之前先加载手风琴?

发布于 2024-09-30 20:37:35 字数 286 浏览 1 评论 0原文

我有一个与此处演示类似的手风琴构造: http://jqueryui.com/demos/accordion/

如果您使用 IE 浏览以上内容,您将看到在手风琴启动之前先加载内容,以便将内容很好地组织到手风琴中。

我的问题是是否可以先加载手风琴,然后再加载内容。这样我们就不会在将原始内容放入手风琴之前先看到它。

可以这样做吗?

谢谢。

亚历克斯

I have an accordion constructed similar to the demo here:
http://jqueryui.com/demos/accordion/

If you browse the above with IE you will see that the content load first before the accordion kicks in to structure content into the accordion nicely.

My question is whether it is possible to get the accordion loaded first and then load the content only after that. This is so that we will not see the raw content first before it got put into the accordion.

Is it possible to do that?

Thanks.

Alex

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

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

发布评论

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

评论(2

薄暮涼年 2024-10-07 20:37:35

最简单的方法是在 CSS 中为所有手风琴内容 div 设置 display: none (甚至可能内联),但永远不要忘记那些没有 Javascript 的人。

我认为所有解决方案对于某些用户来说都会有一些缺点。如果您的网页加载速度很快,那么加载手风琴只需几毫秒......

The easiest way is to set display: none in your CSS (maybe even inline for speed) for all accordion content divs, but never forget about the people without Javascript.

I think all solutions will have some disadvantages for certain users. And if your webpage loads fast, it's a matter of milliseconds to load the accordion after all...

分開簡單 2024-10-07 20:37:35

我最喜欢的类似方法是使用 javascript 在 header 中为 提供一个 className,这使我能够使用不同的 CSS 选择器,无论 JS 是否启用。
阅读此处的描述:Jquery“加载时隐藏”导致Javascript错误

它是如何工作的,你可以在这里看到:http://jsfiddle.net/doktormolle/ HTrTA/

My favourite way to do similar is to give inside the head a className to the <html> using javascript, what gives me the ability to use different CSS-selectors weither JS is enabled or not.
Read the description here: Jquery "hide on load" causing a Javascript error

How it works you can see here: http://jsfiddle.net/doktormolle/HTrTA/

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