Advertisement
konalisp

my_slides.js

Aug 24th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var current = 0;
  2. //$("#slides").css("background", "url('sites/archbig.png')");
  3. //$("#overlay").html("<a id='overlay' href='http://archlinux.org/'></a>");
  4.      
  5. var sites = new Array();
  6. var urls = new Array();
  7.  
  8. sites[0] = "sites/archbig.png";
  9. sites[1] = "sites/ddgsbig.png";
  10.  
  11. urls[0] = "http://archlinux.org/";
  12. urls[1] = "http://duckduckgo.com/";
  13.  
  14. function bec(x,y){
  15.     $("#slides").css("background", "url('" + sites[x] + "')");
  16.     $("#overlay").html("<a id='overlay' href='" + urls[y] + "'></a>");
  17. }
  18.  
  19. bec(0,0);
  20.      
  21. function move(){
  22.     if(current >= 0 && current < urls.length){
  23.         bec(current,current);
  24.     }
  25.     else if (current >= urls.length){
  26.         current = 0;
  27.         move();
  28.     }
  29.     else if (current < 0){
  30.         current = urls.length-1;
  31.         move();
  32.     }
  33.      
  34.     else{ current = 0; }
  35. }
  36.      
  37. function moveleft(){
  38.     current--;
  39.     move();
  40. }
  41.      
  42. function moveright(){
  43.     current++;
  44.     move();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement