Advertisement
Daniel3996

index.html

Jan 4th, 2024 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>test</title>
  7. <style>
  8. .first-line{
  9. margin: 4% 3% 0% 3%;
  10. display: flex;
  11. flex-direction: column;
  12. justify-content: space-between;
  13. position: relative;
  14. }
  15.  
  16.  
  17. div.scroll-container {
  18. background-color: #33333300;
  19. overflow: hidden;
  20. white-space: nowrap;
  21. width:50%;
  22. scroll-behavior: smooth;
  23. }
  24.  
  25. div.scroll-container img {
  26. padding: 0px;
  27. width: 100%;
  28. height: auto;
  29. }
  30.  
  31. .scroll-buttons{
  32. position: absolute;
  33. width:51.6%;
  34. top:58%;
  35. left:1%;
  36. display: flex;
  37. justify-content: space-between;
  38. cursor: pointer;
  39. }
  40.  
  41. .scroll-buttons button{
  42. background-color:rgba(196, 248, 255, 0.377);
  43. width:2em;
  44. height:2em;
  45. border-radius: 50%;
  46. border: 1px solid rgba(0, 0, 0, 0.151);
  47. font-size:1.5em;
  48. font-weight: 900;
  49. color:#2d2d86;
  50. text-shadow: rgb(255, 255, 255) 2px 0px 0px, rgb(255, 255, 255) 1.75517px 0.958851px 0px, rgb(255, 255, 255) 1.0806px 1.68294px 0px, rgb(255, 255, 255) 0.141474px 1.99499px 0px, rgb(255, 255, 255) -0.832294px 1.81859px 0px, rgb(255, 255, 255) -1.60229px 1.19694px 0px, rgb(255, 255, 255) -1.97998px 0.28224px 0px, rgb(255, 255, 255) -1.87291px -0.701566px 0px, rgb(255, 255, 255) -1.30729px -1.5136px 0px, rgb(255, 255, 255) -0.421592px -1.95506px 0px, rgb(255, 255, 255) 0.567324px -1.91785px 0px, rgb(255, 255, 255) 1.41734px -1.41108px 0px, rgb(255, 255, 255) 1.92034px -0.558831px 0px;
  51. }
  52. .dots-container {
  53. display: flex;
  54. justify-content: center;
  55. margin-top: 10px;
  56. }
  57.  
  58. .dot {
  59. width: 12px;
  60. height: 12px;
  61. border-radius: 50%;
  62. background-color: #ccc;
  63. margin: 0 5px;
  64. transition: background-color 0.3s ease-in-out;
  65. }
  66.  
  67. .dot.active {
  68. background-color: #2d2d86; /* Highlight color */
  69. }
  70. .forming{
  71. position: absolute;
  72. top:1px;
  73. bottom:;
  74. left:;
  75. right:1px;
  76. }
  77. </style>
  78. </head>
  79. <body>
  80. <div class="first-line">
  81. <!-- images -->
  82. <div class="scroll-container" id="scroll-container">
  83. <!-- duplicate -->
  84. <img src="./Images/Bunglows/bung-1.png" alt="Cinque Terre">
  85. <img src="./Images/Bunglows/bung-6.png" alt="Forest">
  86. <img src="./Images/Bunglows/bung-3.png" alt="Northern Lights">
  87. <img src="./Images/Bunglows/bung-4.png" alt="Mountains">
  88. <img src="./Images/Bunglows/bung-5.png" alt="Mountains">
  89.  
  90.  
  91. </div>
  92. <div class="dots-container" id="dots-container">
  93. <div class="dot"></div>
  94. <div class="dot"></div>
  95. <div class="dot"></div>
  96. <div class="dot"></div>
  97. <div class="dot"></div>
  98. </div>
  99. <div class="scroll-buttons">
  100. <button onclick="scrollItems('left')">&lt;</button>
  101. <button onclick="scrollItems('right')">&gt;</button>
  102. </div>
  103. <!-- forms -->
  104. <div class="forming">
  105. <h5 class="msg"></h5>
  106. <form>
  107. <input type="text" name="name" id="name" placeholder="name"><br>
  108. <input type="number" name="phone" id="phone" placeholder="phone: +91 xxxx..">
  109. <input type="email" name="email" id="email" placeholder="email"><br>
  110. <textarea name="message" id="message" cols="30" rows="10">Enter your message here...</textarea><br>
  111. <input type="submit" name="submit" id="submit" value="Submit">
  112. </form>
  113. </div>
  114. </div>
  115.  
  116. </div>
  117. <script>
  118. let scrollInterval;
  119. const scrollContainer = document.querySelector('.scroll-container');
  120. const imageWidth = scrollContainer.querySelector('img').clientWidth;
  121.  
  122. function scrollItems(direction) {
  123. if (direction === 'left') {
  124. scrollContainer.scrollLeft -= imageWidth;
  125. } else if (direction === 'right') {
  126. // Check if it's the last image, then scroll to the first image
  127. if (scrollContainer.scrollLeft + scrollContainer.clientWidth === scrollContainer.scrollWidth) {
  128. scrollContainer.scrollLeft = 0;
  129. } else {
  130. scrollContainer.scrollLeft += imageWidth;
  131. }
  132. }
  133. }
  134.  
  135. function startAutoScroll() {
  136. scrollInterval = setInterval(function () {
  137. scrollItems('right');
  138. }, 3000); // Adjust the interval as needed (e.g., 3000 milliseconds for 3 seconds)
  139. }
  140.  
  141. startAutoScroll();
  142.  
  143. function updateActiveDot() {
  144. const scrollContainer = document.querySelector('.scroll-container');
  145. const dotsContainer = document.getElementById('dots-container');
  146. const dots = dotsContainer.querySelectorAll('.dot');
  147. const imageWidth = scrollContainer.querySelector('img').clientWidth;
  148.  
  149. const activeIndex = Math.round(scrollContainer.scrollLeft / imageWidth);
  150.  
  151. dots.forEach((dot, index) => {
  152. dot.classList.toggle('active', index === activeIndex);
  153. });
  154. }
  155.  
  156. // Update active dot on scroll
  157. scrollContainer.addEventListener('scroll', updateActiveDot);
  158. // Initial update
  159. updateActiveDot();
  160. </script>
  161.  
  162.  
  163. </body>
  164. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement