问题描述
|
我目前正在网站上的位置页面上工作,但无法显示/隐藏jquery效果。下面的jQuery可以激活单击并应用div的类来显示/隐藏它……非常简单。但是,当我添加更多具有相同类的div并单击激活器链接时,它将在所有div上运行功能。我知道这是一个简单的修复程序,但是我找不到正确的语法。任何人都可以快速浏览一下此代码,看看如何解决它。我只包括以下html div之一。是当我有多个导致问题的原因。请参阅此处的示例。
谢谢,
泰勒
jQuery的
$(function(){
$(\".sliding\").hide();
$(\".show-hide\").show();
$(\".hide-click\").show();
$(\'.show-hide\').click(function(){
$(\".sliding\").slideToggle(\"slow\");
$(\".hide-click\").slideToggle(\"slow\");
});
});
的HTML
<!-- Bowie,MD -->
<div class=\"location\" style=\"margin-top: 0;\">
<!-- City Name -->
<h3><a href=\"javascript:void(0);\" class=\"show-hide\">Bowie</a></h3>
<h2>Address</h2>
<p>16901 Melford Blvd,Suite 11<br/>
Bowie,MD 20715</p>
<h2>Contact</h2>
<p><span><strong>Phone:</strong> 301.805.5395</span><br />
<span><strong>Fax:</strong> 301.805.5396</span></p>
<span class=\"hide-click\"><a href=\"javascript:void(0);\" class=\"show-hide\">View additional info</a></span>
<!-- Hidden Content -->
<div class=\"sliding\">
<h2>Map</h2>
<div class=\"map\">
<iframe width=\"211\" height=\"140\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=16901+Melford+Blvd,+Suite+11+Bowie,+MD+20715&sll=37.0625,-95.677068&sspn=61.023673,112.236328&ie=UTF8&hq=&hnear=16901+Melford+Blvd,+Bowie,+Maryland+20715&ll=38.959742,-76.714354&spn=0.009344,0.018196&z=14&iwloc=A&output=embed\"></iframe>
</div>
<a href=\"http://maps.google.com/maps?f=d&source=s_d&saddr=16901+Melford+Blvd,+MD+20715&daddr=&hl=en&geocode=&mra=prev&sll=38.959741,-76.714349&sspn=0.00755,0.013422&g=16901+Melford+Blvd,+MD+20715&ie=UTF8&z=17\" target=\"_blank\" class=\"directions\">Get Directions</a>
<h2>Doctors</h2>
<p><a href=\"/#phillips.php\">William B. Phillips,II M.D.</a>,<a href=\"/#weichel.php\">Eric D. Weichel,M.D.</a></p>
<a href=\"javascript:void(0);\" class=\"show-hide\">Hide additional info</a>
</div>
<!-- end Hidden Content -->
</div>
<!-- end Location -->
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)