Skip to content

Instantly share code, notes, and snippets.

@Scretch-1
Last active October 11, 2018 11:01
Show Gist options
  • Save Scretch-1/7bdb0c6bf606d92d5bee to your computer and use it in GitHub Desktop.
Save Scretch-1/7bdb0c6bf606d92d5bee to your computer and use it in GitHub Desktop.
jQ Добавление, удаление класса (наведение, клик)
//Добавление класса при наведении, при клике присваивает класс (mouseenter (.addClass)) при повторном клике убирает класс (mouseleave(.removeClass))
//Пример: <div class="test">test div</div>
//Документация: http://api.jquery.com/on/
$( "div.test" ).on({
click: function() {
$( this ).toggleClass( "activation" 50 );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment