$('div').mouseenter(function() {
$(this).slideUp(150);
});
$('div').mouseenter(function() {
$(this).slideDown(150);
});
How can I combine this into something smaller?
Don't know enough jQuery / JS for this yet.
$('div').mouseenter(function() {
$(this).slideUp(150);
});
$('div').mouseenter(function() {
$(this).slideDown(150);
});
How can I combine this into something smaller?
Don't know enough jQuery / JS for this yet.
$('div').on('mouseenter mouseleave', function() {
...
})
Another benefit of using .on() is event delegation, meaning any future divs will also trigger the events, instead of manually binding the event on them.