12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- var numSlides = 0;
- var currentSlide = 0;
- $(document).ready(function() {
- $(document).keyup(handleKeys);
- numSlides = $("div.slide").css("display", "none").click(nextSlide).each(function (i) {
- $(this).attr("id", "slide_" + i);
- }).size();
- showSlide();
- });
- function handleKeys(e) {
- var keyID = (window.event) ? event.keyCode : e.keyCode;
- switch(keyID) {
- case 32:
- nextSlide();
- break;
- case 37:
- prevSlide();
- break;
- case 38:
- setSlide(0);
- break;
- case 39:
- nextSlide();
- break;
- case 40:
- lastSlide();
- break;
- }
- }
- function showSlide() {
- $("div.slide").css("display", "none");
- $("#slide_" + currentSlide).css("display", "inline");
- }
- function setSlide(number) {
- currentSlide = number;
- showSlide();
- }
- function nextSlide() {
- currentSlide++;
- if (currentSlide >= numSlides) {
- currentSlide = 0;
- }
- showSlide();
- }
- function prevSlide() {
- currentSlide--;
- if (currentSlide < 0) {
- currentSlide = 0;
- }
- showSlide();
- }
- function lastSlide() {
- currentSlide = (numSlides - 1);
- showSlide();
- }
|