Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Помогие разобраться с кодом (https://javascript.ru/forum/misc/51577-pomogie-razobratsya-s-kodom.html)

fabian89 11.11.2014 18:03

Помогие разобраться с кодом
 
Добрый день. Есть вот такой код. Подскажите, пожалуйста, как при повторном клике убирать класс active?

<a id="links" href="#1" onClick="expandit(this), this.className='active'"><i class="">►</i>What's Future Stocks, is my investment safe with you?</a>
									<div style="display: none;" style=&{head};><span>Future Stocks is an investment company based in Panama, city of Panama. Yes, your investment is safe with us. Thanks our security settings, dedicated server with Anti-DDoS protection and EV SSL protection for your transactions, you do not have to worry. Our forex trading experts use “dynamic forex trading” tactics to the best of their abilities. We have been in the forex market for more than a decade and we have been successful since we started, so If you're looking to make a profitable, no-risk investment, Future Stocks has the solution!</span></div>

Erolast 11.11.2014 18:21

<a onclick="expandit(this); this.className = this.className == 'active' ? '' : 'active';">

kostyanet 11.11.2014 18:23

Да это спаммеры набижали.

fabian89 11.11.2014 18:27

Спасибо большое!
А не подскажите еще, пожалуйста, как сделать чтобы блок открывался плавно?

fabian89 11.11.2014 18:30

ну и закрывался, соответственно

Erolast 11.11.2014 18:34

Если подключен jQuery, то
<a onclick="$(this).next('div').slideToggle()"></a>

Если не подключен - подключай или гугли функцию slide.

fabian89 11.11.2014 18:34

Уже сам разобрался. Еще раз спасибо за помощь!

kostyanet 11.11.2014 18:41

У любителя форекса класс меняется. Там все и делается, transition


Часовой пояс GMT +3, время: 08:58.