Created
January 12, 2010 20:10
-
-
Save neerajsingh0101/275557 to your computer and use it in GitHub Desktop.
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
$(document).ready(function() { | |
$(document.documentElement).keypress(function(event) { | |
if (event.which == 37) { | |
$('.slider ul a.current').removeClass('current').parent() // moves up to the li element | |
.prev() // moves to the adjacent li element | |
.find('a') // moves down to the link | |
.addClass('current'); // triggers a click on the previous link | |
} else if (event.which == 39) { | |
// go right | |
$('.slider ul a.current').removeClass('current').parent().next().find('a').addClass('current'); | |
} | |
}); | |
}); |
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
<div class="slider"> | |
<ul> | |
<li><a class="current" href="#1">1</a></li> | |
<li><a href="#2">2</a></li> | |
<li><a href="#3">3</a></li> | |
<li><a href="#4">4</a></li> | |
<li><a href="#5">5</a></li> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment