Advertisement
1xptolevitico69

Slider

Nov 2nd, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang=en>
  3. <head>
  4. <title>Slider</title>
  5. <meta charset=utf-8>
  6. <meta name="viewport" content="width=device-width">
  7. <style>
  8.  
  9. body {  margin:-17px 0;display:block;  }
  10.  
  11. .web1 {  display:flex;flex-direction:row;   }
  12.  
  13. .image {  padding:0 1px;  height:100vh;  }
  14.  
  15. .reminder {  top:10px;left:10px;width:350px;background-color:white;
  16. padding:5px;border-radius:5px;position:fixed;display:none;z-index:1;   }
  17.  
  18. button { border:15px solid white;border-radius:50%;position:fixed;
  19. right:10px;top:10px;padding:0;outline:none;z-index:1;cursor:pointer;  }
  20.  
  21. .web2 {  display:flex;flex-direction:row;position:absolute;top:-1000px;   }
  22.  
  23. .imag {  padding:0 1px; width:70%; height:100vh;  }
  24.  
  25. </style>
  26. </head>
  27. <body>
  28.  
  29. <div id='div' class='reminder'>
  30. Images were set according their original aspect ratio. That's why we only set the height.
  31. If we set dimensions like width/height <a onclick='down()' href='#'>( images allow that )</a> some images will get some distortion.
  32. </div>
  33. <button onclick='bt()'></button>
  34.  
  35. <div id='web1' class='web1'>
  36. <img class='image' src='https://images.pexels.com/photos/1592384/pexels-photo-1592384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  37. <img class='image' src='https://images.pexels.com/photos/3138903/pexels-photo-3138903.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  38. <img class='image' src='https://images.pexels.com/photos/2198544/pexels-photo-2198544.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  39. <img class='image' src='https://images.pexels.com/photos/2115984/pexels-photo-2115984.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  40. <img class='image' src='https://images.pexels.com/photos/134392/pexels-photo-134392.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  41. <img class='image' src='https://images.pexels.com/photos/40831/glass-a-bottle-of-simplicity-studio-40831.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  42. <img class='image' src='https://images.pexels.com/photos/63249/stefan-bradl-motogp-racing-racing-bike-63249.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  43. <img class='image' src='https://images.pexels.com/photos/33689/ship-boat-lake-garda-italy.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  44. </div>
  45.  
  46.  
  47. <div id='web2' class='web2'>
  48. <img class='imag' src='https://images.pexels.com/photos/1592384/pexels-photo-1592384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  49. <img class='imag' src='https://images.pexels.com/photos/3138903/pexels-photo-3138903.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  50. <img class='imag' src='https://images.pexels.com/photos/2198544/pexels-photo-2198544.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  51. <img class='imag' src='https://images.pexels.com/photos/2115984/pexels-photo-2115984.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  52. <img class='imag' src='https://images.pexels.com/photos/134392/pexels-photo-134392.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  53. <img class='imag' src='https://images.pexels.com/photos/40831/glass-a-bottle-of-simplicity-studio-40831.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  54. <img class='imag' src='https://images.pexels.com/photos/63249/stefan-bradl-motogp-racing-racing-bike-63249.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  55. <img class='imag' src='https://images.pexels.com/photos/33689/ship-boat-lake-garda-italy.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'/>
  56. </div>
  57.  
  58.  
  59. <script>
  60. i=0;c=0;
  61.  
  62. function bt(){
  63. if(i==0){
  64. div.style.display='block';
  65. i=1;
  66. }else if(i==1){
  67. div.style.display='none';
  68. i=0;
  69. }
  70. }
  71.  
  72. function down(){
  73. if(c==0){
  74. web1.setAttribute('style','position:absolute;top:-1000px;');
  75. web2.setAttribute('style','top:-17px;');
  76. c=1;
  77. }else if(c==1){
  78. web2.setAttribute('style','top:-1000px;');
  79. web1.setAttribute('style','position:absolute;top:-17px;');
  80. c=0;
  81. }
  82. }
  83.  
  84. </script>
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement