Guest User

Untitled

a guest
Jan 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. total = 83;
  2. show = 5;
  3. current = 2;
  4.  
  5. left = 0;
  6. index = 0;
  7.  
  8. $(document).ready(function(){
  9.     for (var i = 0 ; i < 5 ; i++)
  10.     {
  11.         image(i);
  12.         $("#caroussel img").eq(i)
  13.             .css("position", "absolute")
  14.             .css("left", left+"px")
  15.             .css("z-index",index);
  16.         left += 150;
  17.         if (i < 2)
  18.             index++;
  19.         else
  20.             index--;
  21.     }    
  22. });
  23.  
  24. function image(id)
  25. {
  26.     $("#caroussel").append("<img id='image"+id+"'/>");
  27.     $.post(
  28.         "imageUrl.php",
  29.         {
  30.             "n":current,
  31.             "id":id
  32.         },
  33.         function (data) {
  34.             var id_name = "#image"+id;
  35.             $(id_name).attr("src",data.url);
  36.         },
  37.         "json"
  38.     );
  39. }
Add Comment
Please, Sign In to add comment