Advertisement
fr1sk

Untitled

May 5th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <style type="text/css">
  6.  
  7. .galerija{
  8. width: 350px;
  9. height: 350px;
  10. top: 0;
  11. left: 0;
  12. border: 2px solid red;
  13. position: relative;
  14. box-sizing:border-box;
  15.  
  16. }
  17. .slike{
  18. margin-left: 22px;
  19. box-sizing:border-box;
  20. margin-top: 20px;
  21.  
  22.  
  23. }
  24. input{
  25. width: 100px;
  26. height: 50px;
  27. position: relative;
  28. left: 20px;
  29. top: 10px;
  30.  
  31.  
  32. }
  33. </style>
  34. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
  35. <script>
  36. $(document).ready(function(){
  37.  
  38. var i = 0;
  39.  
  40. $(".galerija div:gt(0)").hide(); //div greater then
  41.  
  42. $("#napred").on("click", function(){
  43.  
  44. if(i<4){
  45. $("galerija div:eq("+ i +")").fadeOut(1000).next().fadeIn(1000);
  46. i++;
  47. }
  48. else{
  49. i=0;
  50. $("galerija div:eq("+i+")").fadeIn(1000);
  51. }
  52.  
  53. });
  54.  
  55. $("#slideshow").on("click", function(){
  56. window.setInterval(function(){
  57. if(i<4){
  58. $("galerija div:eq("+i+")").fadeOut(1000).next().fadeIn(1000);
  59. i++;
  60. }
  61. else{
  62. i=0;
  63. $("galerija div:eq("+i+")").fadeIn(1000);
  64. }
  65. }, 1000);
  66.  
  67.  
  68. });
  69.  
  70. });
  71. </script>
  72. </head>
  73. <body>
  74. <div class="galerija">
  75. <div class="slike">
  76. <img src="slike/1.jpg" height="300" width="300" alt="lol">
  77. </div>
  78. <div class="slike">
  79. <img src="slike/2.jpg" height="300" width="300" alt="lol">
  80. </div>
  81. <div class="slike">
  82. <img src="slike/3.jpg" height="300" width="300" alt="lol">
  83. </div>
  84. <div class="slike">
  85. <img src="slike/4.jpg" height="300" width="300" alt="lol">
  86. </div>
  87. </div>
  88.  
  89. <input type="button" value="nazad" id="nazad">
  90. <input type="button" value="napred" id="napred">
  91. <input type="button" value="slideshow" id="slideshow">
  92.  
  93. </body>
  94. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement