1 2jQuery(document).ready(function($) { 3 //----------------START APPEL CARROUSEL HOME-------------- 4 var $carousel = $('.movie-featured'); 5 6 // Détruire l'instance existante 7 $carousel.trigger('destroy.owl.carousel'); 8 9 // Réinitialiser avec ton config 10 $carousel.owlCarousel({ 11 loop:true, 12 transition:'fade', 13 dots:true, 14 autoHeight: false, 15 nav:true, // â tu actives les flèches ici 16 navText:[ 17 '<span class="owl-prev">â¹</span>', 18 '<span class="owl-next">âº</span>' 19 ], 20 rtl:$("html").attr("dir") === "ltr", 21 autoplay:true, 22 autoplayTimeout:3250, 23 autoplayHoverPause:true, 24 lazyLoad:true, 25 responsive:{ 26 0:{ items:1 }, 27 420:{ items:1 }, 28 767:{ items:1 }, 29 1050:{ items:1 }, 30 1250:{ items:1 } 31 } 32 }); 33 //----------------END APPEL CARROUSEL HOME-------------- 34 35 //----------------START APPEL POUR SLIDE PROCHAINEMENT-------------- 36 (function(){ 37 const container = document.getElementById("movieSlider"); 38 if (!container) return; // si le container n'existe pas, on sort du script 39 40 const track = container.querySelector(".movie-slider-track"); 41 const slides = Array.from(container.querySelectorAll(".movie-slide")); 42 const prevBtn = document.getElementById("moviePrev"); 43 const nextBtn = document.getElementById("movieNext"); 44 45 let currentIndex = 0; 46 let startX = 0; 47 let currentTranslate = 0; // position courante en px 48 let prevTranslate = 0; // position avant le drag 49 let dragging = false; 50 let animationID = 0; 51 52 function onResize(){ 53 // recalcul du max selon le nouveau viewport 54 const visible = getVisibleCount(); 55 const maxIndex = Math.max(0, slides.length - visible); 56 57 // si lâindex dépasse, on le ramène à la valeur max 58 if(currentIndex > maxIndex){ 59 currentIndex = maxIndex; 60 } 61 62 // repositionne le slider proprement 63 snapToIndex(currentIndex); 64 65 // recalcule l'état des flèches 66 updateButtons(); 67 } 68 69 70 function getVisibleCount(){ 71 const width = window.innerWidth; 72 if(width <= 600) return 1; 73 if(width <= 750) return 2; 74 if(width <= 1024) return 3; 75 return 4; 76 } 77 78 function slideWidthPx(){ 79 const visible = getVisibleCount(); 80 return container.clientWidth / visible; 81 } 82 83 function clampIndex(idx){ 84 const visible = getVisibleCount(); 85 const maxIndex = Math.max(0, slides.length - visible); 86 return Math.min(Math.max(0, idx), maxIndex); 87 } 88 89 function setTransform(px){ 90 // s'assurer que px est un nombre (ex: -120.5) 91 var n = Number(px) || 0; 92 track.style.transform = 'translateX(' + n + 'px)'; 93 } 94 95 function updateButtons(){ 96 const visible = getVisibleCount(); 97 prevBtn.classList.toggle("disabled", currentIndex === 0); 98 nextBtn.classList.toggle("disabled", (currentIndex + visible) >= slides.length); 99 } 100 101 function snapToIndex(idx){ 102 currentIndex = clampIndex(idx); 103 const w = slideWidthPx(); 104 currentTranslate = - currentIndex * w; 105 prevTranslate = currentTranslate; 106 track.style.transition = "transform 0.35s cubic-bezier(.22,.9,.32,1)"; 107 setTransform(currentTranslate); 108 updateButtons(); 109 // remove transition after it finished so drag is immediate next time 110 clearTimeout(track._tt); 111 track._tt = setTimeout(()=> track.style.transition = "", 360); 112 } 113 114 function animation(){ 115 setTransform(currentTranslate); 116 if(dragging) requestAnimationFrame(animation); 117 } 118 119 /* ----- pointer handlers (unifie souris + touch) ----- */ 120 function onPointerDown(e){ 121 // n'accepte que le bouton principal de la souris 122 if(e.pointerType === "mouse" && e.button !== 0) return; 123 124 dragging = true; 125 startX = e.clientX; 126 // cancel possible snapping transition 127 track.style.transition = ""; 128 prevTranslate = currentTranslate; 129 // capture pointer so move/up are delivered to us even si la souris sort du container 130 e.target.setPointerCapture && e.target.setPointerCapture(e.pointerId); 131 132 animationID = requestAnimationFrame(animation); 133 } 134 135 function onPointerMove(e){ 136 if(!dragging) return; 137 const dx = e.clientX - startX; 138 currentTranslate = prevTranslate + dx; 139 // optional: clamp translate so on very large drags we don't go insane 140 const maxTranslate = 0; 141 const minTranslate = - (slides.length * slideWidthPx()) + slideWidthPx() * getVisibleCount(); 142 if(currentTranslate > maxTranslate + 100) currentTranslate = maxTranslate + 100; 143 if(currentTranslate < minTranslate - 100) currentTranslate = minTranslate - 100; 144 } 145 146 function onPointerUp(e){ 147 if(!dragging) return; 148 dragging = false; 149 cancelAnimationFrame(animationID); 150 151 // calcule déplacement et décider du snap 152 const w = slideWidthPx(); 153 const movedPx = currentTranslate - prevTranslate; 154 155 // seuil: 25% de la largeur d'une slide pour changer d'index 156 const threshold = w * 0.25; 157 158 let newIndex = currentIndex; 159 if(movedPx < -threshold) newIndex = currentIndex + 1; 160 else if(movedPx > threshold) newIndex = currentIndex - 1; 161 162 // snap 163 snapToIndex(newIndex); 164 165 // release pointer capture 166 try { e.target.releasePointerCapture && e.target.releasePointerCapture(e.pointerId); } catch(err){} 167 } 168 169 /* ----- events ----- */ 170 // use pointer events on the container 171 container.addEventListener("pointerdown", onPointerDown);
172 173 window.addEventListener("pointermove", onPointerMove); 174 window.addEventListener("pointerup", onPointerUp); 175 window.addEventListener("pointercancel", onPointerUp); 176 177 /* ----- buttons ----- */ 178 nextBtn.addEventListener("click", function(){ 179 const visible = getVisibleCount(); 180 snapToIndex(clampIndex(currentIndex + 1)); 181 }); 182 183 prevBtn.addEventListener("click", function(){ 184 snapToIndex(clampIndex(currentIndex - 1)); 185 }); 186 187 /* resize -> recalcule position pour garder l'élément visible */ 188 /*window.addEventListener("resize", function(){ 189 snapToIndex(currentIndex); // repositionne proprement selon le nouveau slideWidth 190 });*/ 191 window.addEventListener("resize", onResize); 192 193 // initial 194 195 snapToIndex(0); 196updateButtons(); // <- indispensable 197 198})(); 199 //----------------END APPEL POUR SLIDE PROCHAINEMENT-------------- 200 201 //-------------------START EFFET STICKY SUR LE MENU DEROULANT CATALOGUE-------------------------- 202/* (function() { 203 // Sélecteurs â adapte si nécessaire 204 var sidebar = document.querySelector('.ContainSidebar'); 205 if (!sidebar) return; 206 207 // wrapper qui contient la zone (utilisé pour limiter le sticky) 208 var container = document.querySelector('.sml-wrapper') || sidebar.parentElement; 209 210 // créer un placeholder (préserve le flow quand on fixe l'élément) 211 var placeholder = document.createElement('div'); 212 placeholder.className = 'ContainSidebar-placeholder'; 213 placeholder.style.display = 'none'; 214 sidebar.parentNode.insertBefore(placeholder, sidebar); 215 216 // utilitaires 217 function getOffset(el) { 218 var rect = el.getBoundingClientRect(); 219 var docEl = document.documentElement; 220 return { 221 top: rect.top + window.pageYOffset - docEl.clientTop, 222 left: rect.left + window.pageXOffset - docEl.clientLeft, 223 width: rect.width, 224 height: rect.height 225 }; 226 } 227 228 var sidebarRect = getOffset(sidebar); 229 var containerRect = getOffset(container); 230 var topSpacing = 20; // espace sous le header â ajuste si besoin 231 232 function recalc() { 233 sidebarRect = getOffset(sidebar); 234 containerRect = getOffset(container); 235 } 236 237 function onScroll() { 238 var scrollY = window.pageYOffset || document.documentElement.scrollTop; 239 // position à partir de laquelle on fixe la sidebar 240 var start = sidebarRect.top - topSpacing; 241 // position où on doit relâcher la sidebar (fin du container) 242 var end = containerRect.top + containerRect.height - topSpacing - sidebarRect.height; 243 244 if (scrollY >= start && scrollY <= end) { 245 // fixe l'élément 246 if (!sidebar.classList.contains('sticky-fixed')) { 247 // afficher le placeholder pour garder la hauteur 248 placeholder.style.display = 'block'; 249 placeholder.style.width = sidebarRect.width + 'px'; 250 placeholder.style.height = sidebarRect.height + 'px'; 251 252 sidebar.classList.add('sticky-fixed'); 253 sidebar.style.width = sidebarRect.width + 'px'; 254 sidebar.style.left = (sidebarRect.left) + 'px'; 255 } 256 // si la largeur du container change lors du redimensionnement, handled in resize 257 } else { 258 // remettre dans le flux 259 if (sidebar.classList.contains('sticky-fixed')) { 260 sidebar.classList.remove('sticky-fixed'); 261 sidebar.style.width = ''; 262 sidebar.style.left = ''; 263 placeholder.style.display = 'none'; 264 } 265 266 // si on dépasse la fin, on peut "coller" la sidebar en bas du container 267 if (scrollY > end) { 268 // position absolue relative au container pour ne pas dépasser 269 sidebar.style.position = 'absolute'; 270 sidebar.style.top = (containerRect.height - sidebarRect.height) + 'px'; 271 sidebar.style.left = ''; 272 } else { 273 // remettre le positionnement normal 274 sidebar.style.position = ''; 275 sidebar.style.top = ''; 276 } 277 } 278 } 279 280 function onResize() { 281 // reset styles temporaires pour recalcul propre 282 sidebar.classList.remove('sticky-fixed'); 283 sidebar.style.width = ''; 284 sidebar.style.left = ''; 285 sidebar.style.position = ''; 286 placeholder.style.display = 'none'; 287 recalc(); 288 onScroll(); 289 } 290 291 // initialisation au chargement (après images, fonts) 292 window.addEventListener('load', function() { 293 recalc(); 294 onScroll(); 295 }); 296 297 window.addEventListener('scroll', onScroll); 298 window.addEventListener('resize', function() { 299 // throttle simple 300 clearTimeout(window._sml_resize_timer); 301 window._sml_resize_timer = setTimeout(onResize, 80); 302 }); 303 })(); 304 //-------------------END EFFET STICKY SUR LE MENU DEROULANT CATALOGUE-------------------------- 305 */ 306}); 307
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.