[英]sliding up down DIV on click with more categories
I have very little understanding of javascripting so i would really appreciate it if someone helps me out 我对javascript的了解很少,因此如果有人帮助我,我将非常感谢
i would like this effect http://jsfiddle.net/dJS4g/ but instead of one link i would like to have 6 links that will show different content on click 我想要这种效果http://jsfiddle.net/dJS4g/,但我希望有6个链接,这些链接在点击时会显示不同的内容,而不是一个链接
javascript
$(function()
{
$("a#toggle").click(function()
{
$("#contact").slideToggle();
return false;
});
});
html
<div id="contact">
Contact me!
</div>
<a href="#" id="toggle">Contact</a>
css
#contact
{
display: none;
background: grey;
color: #FFF;
padding: 10px;
}
** **
FOUND WHAT I WAS LOOKING FOR HERE http://jsfiddle.net/jakecigar/XwN2L/2154/ THANK YOU EVERYONE FOR YOUR HELP 在这里找到了我想要的东西http://jsfiddle.net/jakecigar/XwN2L/2154/谢谢大家的帮助
** **
Something like this? 像这样吗 Fiddle 小提琴
$(function () {
$("#all").click(function () {
$("#newborn").slideToggle();
$("#family").slideToggle();
$("#senior").slideToggle();
$("#portrait").slideToggle();
$("#wedding").slideToggle();
return false;
});
});
In this way by clicking on the first div, the others are shown. 这样,通过单击第一个div,将显示其他区域。 Clicking again the others divs disappear. 再次单击其他div会消失。
Pay attention: don't set the slideToggle()
even to the #all
div because otherwise you can't toggle the other divs anymore 请注意:甚至不要将slideToggle()
设置为#all
div,否则您将无法再切换其他div
you can check below both jsfiddle
file. 您可以在下面的两个jsfiddle
文件中进行检查。 it's working fine. 工作正常。
http://jsfiddle.net/UpuDU/ [ Accordion Type ] http://jsfiddle.net/UpuDU/ [手风琴类型]
http://jsfiddle.net/UpuDU/6/ [ Tab Type ] http://jsfiddle.net/UpuDU/6/ [标签类型]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.