Skip to content

Instantly share code, notes, and snippets.

@advitum
advitum / Mixed Compass Mixins.scss
Last active November 2, 2016 09:44
Just some random useful Compass mixins I have written and collected over the time.
// Proper clearfix without overflow:hidden
@mixin clearfix {
&:after {
content: "";
width: 100%;
height: 0;
display: block;
clear: both;
}
}
@advitum
advitum / Lingering Hover.js
Last active September 28, 2016 12:21
You know how it is sometimes very hard to use a multi-level website navigation because it immediately closes when you accidentally move your mouse out of the navigation element and you have to start over? This script just adds a "lingering" class to the element, so your navigation can wait half a second before closing again.
$element.on('mouseenter', function(event) {
window.clearTimeout($(this).data('hover-timeout'));
$(this).addClass('hover').siblings('.hover').removeClass('hover');
}).on('mouseleave', function(event) {
(function($element) {
$element.data('hover-timeout', window.setTimeout(function() {
$element.removeClass('hover');
}, 500));
})($(this));
});