如何使用Jquery显示与点击链接相关的DIV并隐藏其他DIV?
正如我在主题中总结的那样,我想显示与单击的链接相关的 DIV 并使用 Jquery 隐藏其他 DIV。为了能够理解我在说什么,请访问 Worldlines
您将在那里看到与一些新闻相关的主题。当有人单击某个主题时,新闻 div 将滑落到单击的主题下方,之前阅读的新闻 div 将隐藏。
我想我已经清楚地表达了我想要的东西。
谢谢你,
As I summarized at topic I want to show the DIV related with clicked link and hide other DIVs with Jquery. To be able to understand what I am saying, please visit Worldlines
You will see there the topics related with some news. When somebody clicked on a topic the news div will slide-down below clicked topic and previously read news div will hide.
I think I told what I want clearly.
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将在 html 的开头添加一个脚本,如下所示:
这将隐藏一个面板并显示另一个面板。 “Panel1”和“Panel2”只是您要显示或隐藏的面板的 ID。然后您的按钮上将包含以下代码:
如果您想隐藏多个面板,这应该足够简单,可以进行修改。
You'll add a script at the beginning of your html like so:
This will hide one panel and show another. The "Panel1" and "Panel2" are simply the IDs of the panels you'll be showing or hiding. And then you'll have the following code on your button:
This should be simple enough to modify if you want to hide multiple panels.
Jquery Accordion 正是我所寻找的。您可以在这里找到它 http://jqueryui.com/demos/accordion/
Jquery Accordion was what I look for. You can find it here http://jqueryui.com/demos/accordion/