Advertisement
prashandip

x-carousel

Feb 10th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.72 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <title>Owl Carousel</title>
  8. <!-- Font -->
  9. <link rel="preconnect" href="https://fonts.gstatic.com">
  10. <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
  11. <!-- Owl Carousel CSS -->
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" integrity="sha512-tS3S5qG0BlhnQROyJXvNjeEM4UpMXHrQfTGmbQ1gKmelCxlSEBUaxhRBj/EFTzpbP4RVSrpEikbmdJobCvhE3g==" crossorigin="anonymous" />
  13. <!-- Owl Carousel Default Theme -->
  14. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css" integrity="sha512-sMXtMNL1zRzolHYKEujM2AqCLUR9F2C4/05cdbxjjLSRvMQIciEPCQZo++nk7go3BtSuK9kfa/s+a4f4i5pLkw==" crossorigin="anonymous" />
  15. <!-- Fontawesome -->
  16. <script src="https://kit.fontawesome.com/67b6e93a48.js"></script>
  17. <style>
  18. * {
  19. font-family: 'Roboto', sans-serif;
  20. }
  21.  
  22. img {
  23. box-shadow: 0 0 2px #000;
  24. transition: ease-out all 0.5s;
  25. }
  26.  
  27. .img-hover {
  28. transform: scale(1.03);
  29. }
  30.  
  31.  
  32. .owl-prev,
  33. .owl-next {
  34. position: absolute;
  35. top: 50%;
  36. transform: translateY(-50%);
  37. display: block !important;
  38. border: none;
  39. }
  40.  
  41. .owl-next:focus,
  42. .owl-prev:focus {
  43. outline: none;
  44. }
  45.  
  46.  
  47. .owl-prev {
  48. left: 20px;
  49. }
  50.  
  51. .owl-next {
  52. right: 20px;
  53. }
  54.  
  55. .owl-prev i,
  56. .owl-next i {
  57. width: 300%;
  58. height: 100%;
  59. transform: scale(2, 5);
  60. border-radius: 50%;
  61. color: aliceblue;
  62. background: rgba(0, 0, 0, 0.5);
  63. }
  64.  
  65. .x-carousel-item {
  66. cursor: pointer;
  67. position: relative;
  68. padding: 10px 0;
  69. transition: linear all 0.5s;
  70. }
  71.  
  72. .x-carousel-item-content {
  73. color: white;
  74. padding: 5px 10px;
  75. text-align: justify;
  76. text-justify: inter-word;
  77. background: #00000080;
  78. cursor: pointer;
  79. transform: translateY(65%);
  80. transition: linear all 0.5s;
  81. }
  82.  
  83. .x-carousel-item-content-wrapper {
  84. overflow: hidden;
  85. position: absolute;
  86. min-width: 100px;
  87. min-height: 100px;
  88. bottom: 10px;
  89. left: 0;
  90. }
  91.  
  92. .x-carousel-item-content-translate {
  93. transform: translateY(0%);
  94.  
  95. }
  96.  
  97. .x-carousel-item-content-wrapper-scale {
  98. transform: scale(1.03);
  99. }
  100. </style>
  101. </head>
  102.  
  103. <body>
  104. <div class="owl-carousel owl-theme">
  105. <div class="item ">
  106. <div class="x-carousel-item">
  107. <img src="./img/p1.jpg">
  108. <div class="x-carousel-item-content-wrapper">
  109. <div class="x-carousel-item-content">
  110. <h4>Pradesh 1</h4>
  111. <p>Here will be the contents of pradesh 1. Whatever anything and everything write here. Here will be the contents of pradesh 1. Whatever anything and everything write here.</p>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="item">
  117. <div class="x-carousel-item">
  118. <img src="./img/p2.jpg">
  119. <div class="x-carousel-item-content-wrapper">
  120. <div class="x-carousel-item-content">
  121. <h4>Pradesh 2</h4>
  122. <p>Here will be the contents of pradesh 2. Whatever anything and everything write here. Here will be the contents of pradesh 2. Whatever anything and everything write here.</p>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="item ">
  128. <div class="x-carousel-item">
  129. <img src="./img/p3.jpg">
  130. <div class="x-carousel-item-content-wrapper">
  131. <div class="x-carousel-item-content">
  132. <h4>Pradesh 3</h4>
  133. <p>Here will be the contents of pradesh 3. Whatever anything and everything write here. Here will be the contents of pradesh 3. Whatever anything and everything write here.</p>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="item ">
  139. <div class="x-carousel-item">
  140. <img src="./img/p4.jpg">
  141. <div class="x-carousel-item-content-wrapper">
  142. <div class="x-carousel-item-content">
  143. <h4>Pradesh 4</h4>
  144. <p>Here will be the contents of pradesh 4. Whatever anything and everything write here. Here will be the contents of pradesh 4. Whatever anything and everything write here.</p>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="item ">
  150. <div class="x-carousel-item">
  151. <img src="./img/p5.jpg">
  152. <div class="x-carousel-item-content-wrapper">
  153. <div class="x-carousel-item-content">
  154. <h4>Pradesh 5</h4>
  155. <p>Here will be the contents of pradesh 5. Whatever anything and everything write here. Here will be the contents of pradesh 5. Whatever anything and everything write here.</p>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="item ">
  161. <div class="x-carousel-item">
  162. <img src="./img/p6.jpg">
  163. <div class="x-carousel-item-content-wrapper">
  164. <div class="x-carousel-item-content">
  165. <h4>Pradesh 6</h4>
  166. <p>Here will be the contents of pradesh 6. Whatever anything and everything write here. Here will be the contents of pradesh 6. Whatever anything and everything write here.</p>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="item ">
  172. <div class="x-carousel-item">
  173. <img src="./img/p7.jpg">
  174. <div class="x-carousel-item-content-wrapper">
  175. <div class="x-carousel-item-content">
  176. <h4>Pradesh 7</h4>
  177. <p>Here will be the contents of pradesh 7. Whatever anything and everything write here. Here will be the contents of pradesh 7. Whatever anything and everything write here.</p>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <!-- jQuery -->
  184. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
  185. <!-- Owl Carousel JS -->
  186. <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js" integrity="sha512-bPs7Ae6pVvhOSiIcyUClR7/q2OAsRiovw4vAkX+zJbw3ShAeeqezq50RIIcIURq7Oa20rW2n2q+fyXBNcU9lrw==" crossorigin="anonymous"></script>
  187. <script>
  188. $('.owl-carousel').owlCarousel({
  189. loop: true,
  190. margin: 10,
  191. nav: true,
  192. dots: false,
  193. autoplay: true,
  194. stagePadding: 50,
  195. autoplayTimeout: 4000,
  196. responsiveClass: true,
  197. responsive: {
  198. 0: {
  199. items: 1
  200. },
  201. 600: {
  202. items: 2
  203. },
  204. 1000: {
  205. items: 3
  206. },
  207. 1300: {
  208. items: 4
  209. }
  210. },
  211. navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>']
  212. })
  213. var items = document.getElementsByClassName('x-carousel-item');
  214. jQuery.each(items, function(i, item) {
  215. $(item).hover(
  216. function() {
  217. console.log('enter' + i);
  218. $(item).find(".x-carousel-item-content").addClass('x-carousel-item-content-translate');
  219. $(item).find(".x-carousel-item-content-wrapper").addClass('x-carousel-item-content-wrapper-scale');
  220. $(item).find('img').addClass('img-hover');
  221. },
  222. function() {
  223. console.log('exit' + i);
  224. $(item).find(".x-carousel-item-content").removeClass('x-carousel-item-content-translate');
  225. $(item).find(".x-carousel-item-content-wrapper").removeClass('x-carousel-item-content-wrapper-scale');
  226. $(item).find('img').removeClass('img-hover');
  227. }
  228. );
  229. $(item).click(function(event) {
  230. alert('You clicked' + $(item).find('h4').html());
  231. });
  232. });
  233. </script>
  234. </body>
  235.  
  236. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement