Организация выезжающего блока
У меня есть выезжающий <div>
<script> <span class="highlight">function</span> <span class="highlight">anichange</span> <span class="highlight">(objName)</span> { if ( $(objName).css('display') == 'none' ) { $(objName).animate({height: 'show'}, 400); } else { $(objName).animate({height: 'hide'}, 200); } } </script> Вывожу следующим образом: <a href="#" onclick="anichange('#divId'); return false">Открыть/Закрыть</a> <div id="divId" style="display: none"> Тут тукст<br> </div> Этих блоков 6 шт. при нажатии открывается блок, как сделать чтоб при нажатии на другой блок активный закрывался. Пробовал вот так: первый способ: function anichange (objName) { $('#divId@').hide(); if ( $(objName).css('display') == 'none' ) { $(objName).animate({height: 'show'}, 400); } else { $(objName).animate({height: 'hide'}, 200); } } второй способ: function anichange (objName) { $('#divId@').animate({height: 'hide'}, 200); if ( $(objName).css('display') == 'none' ) { $(objName).animate({height: 'show'}, 400); } else { $(objName).animate({height: 'hide'}, 200); } } третий способ: function anichange (objName) { $('#divId@').css("display","none"); if ( $(objName).css('display') == 'none' ) { $(objName).animate({height: 'show'}, 400); } else { $(objName).animate({height: 'hide'}, 200); } } Но ничего не получилось. |
rrommka,
форум - поиск - открывашка |
Часовой пояс GMT +3, время: 21:11. |