Skip to content

Instantly share code, notes, and snippets.

@coopermaruyama
Created October 28, 2012 08:46
Show Gist options
  • Save coopermaruyama/3968083 to your computer and use it in GitHub Desktop.
Save coopermaruyama/3968083 to your computer and use it in GitHub Desktop.
jQuery/CSS fading overlay div that deletes itself
$('.element').hover(
->
unless $(this).children('span.overlay').length
$(this).append('<span class="overlay"></span>')
$('span.overlay',this).fadeIn(350)
,->
$('span.overlay',this).fadeOut(350)
window.setTimeout ->
$(this).children('span.overlay').remove()
350
)
span.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .3;
background-color: lighten($blue,70%);
display:none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment