admin管理员组文章数量:1300197
I know this is a really broad question, but when I try to google it all I get is the answer for a drop down menu.
I'm looking for the code for the dropdown text like it's done here when you click on a question. Or at least a name so I can google more specifically.
I know this is a really broad question, but when I try to google it all I get is the answer for a drop down menu.
I'm looking for the code for the dropdown text like it's done here when you click on a question. Or at least a name so I can google more specifically.
Share edited Jun 3, 2012 at 14:58 Gilles 'SO- stop being evil' 108k38 gold badges215 silver badges260 bronze badges asked Jun 3, 2012 at 13:34 FawkyFawky 411 gold badge4 silver badges7 bronze badges2 Answers
Reset to default 4Here's a Fiddle with the code to do this: http://jsfiddle/Zy4gW/
HTML:
<ul id="q-and-a">
<li><a>Question One</a>
<div>Answer to Question One...</div>
</li>
<li><a>Question Two</a>
<div>Answer to Question Two...</div>
</li>
</ul>
CSS:
ul { margin: 0; padding: 0; }
ul li { margin: 0; padding: 0; list-style: none; }
ul li a { color: blue; }
ul li div { display: none; }
JQuery:
$(function(){
$('#q-and-a li a').each(function(){
$(this).click(function(){
$(this).siblings('div').slideToggle(300);
});
});
});
You probably don't need a plugin for something this simple. Just setup the right structure and then show/hide the 'reveal' content.
That's what you call an accordion, and jQueryUI has one. By default, it doesn't act like the one in the website, but it can be configured to act the same way.
本文标签: javascriptDrop down text like on this particular websiteStack Overflow
版权声明:本文标题:javascript - Drop down text like on this particular website - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741659567a2390954.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论