Skip to content

Instantly share code, notes, and snippets.

@nikartx
Created February 5, 2016 17:48
Show Gist options
  • Save nikartx/05acba0e5b793746bd86 to your computer and use it in GitHub Desktop.
Save nikartx/05acba0e5b793746bd86 to your computer and use it in GitHub Desktop.
JS timeout for hover over an element
//Set timeout if hover over an element
$(document).ready(function() {
$('#slider').hover(
// if hover over an element
function(){
setTimeout(function() {
$('i.arrows').css({"opacity":"1"});
},
300);
},
// if don't bring element
function(){
setTimeout(function() {
$('i.arrows').css({"opacity":"0"});
},
500);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment