Created
April 20, 2013 19:27
-
-
Save sandeshdamkondwar/5427085 to your computer and use it in GitHub Desktop.
Mouse Press Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('*').hover(function() { | |
$(this).data('hover', 1); //store in that element that the mouse is over it | |
}, | |
function() { | |
$(this).data('hover', 0); //store in that element that the mouse is no longer over it | |
}); | |
window.isHovering = function (selector) { | |
return $(selector).data('hover') ? true : false; //check element for hover property | |
} | |
$(document).keydown(function(e){ | |
if (e.keyCode == 37 ) { | |
if (isHovering('.controlcontent_r')) | |
moveSlide("previous"); | |
else if (isHovering('#mainSlide')) | |
$('#mainSlide .slidesjs-next').trigger('click'); | |
} else if (e.keyCode == 39 ) { | |
if (isHovering('.controlcontent_r')) | |
moveSlide("next"); | |
else if (isHovering('#mainSlide')) | |
$('#mainSlide .slidesjs-previous').trigger('click'); | |
} | |
}); | |
// 37 - left | |
// 38 - up | |
// 39 - right | |
// 40 - down |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment