1(function ($) { //an IIFE so safely alias jQuery to $ 2 $.NewLaunchesSlider = function (element) { 3 4 //stores the passed element as a property of the created instance. 5 6 if (element instanceof $) { 7 this.element = element 8 } else { 9 this.element = $(element); 10 this.elementSelector = element; 11 } 12 }; 13 14 //assigning an object literal to the prototype is a shorter syntax 15 //than assigning one property at a time 16 $.NewLaunchesSlider.prototype = { 17 Init: function () { 18 if (this.element.length == 0) { return; } 19 var swiper = new Swiper(this.elementSelector, $.NewLaunchesSlider.defaultOptions); 20 21 $('#newlaunches-next').on('click', function () { 22 $('.newlaunches-next').trigger('click'); 23 }); 24 $('#newlaunches-prev').on('click', function () { 25 $('.newlaunches-prev').trigger('click'); 26 }); 27 } 28 29 }; 30 31 $.NewLaunchesSlider.defaultOptions = { 32 slidesPerView: 1, 33 spaceBetween: 0, 34 navigation: { 35 nextEl: ".swiper-button-next", 36 prevEl: ".swiper-button-prev" 37 }, 38 pagination: { 39 el: ".newlaunches-pagination", 40 clickable: true 41 }, 42 breakpoints: { 43 567: { 44 slidesPerView: 1, 45 spaceBetween: 0, 46 }, 47 768: { 48 slidesPerView: 2, 49 spaceBetween: 25, 50 }, 51 1024: { 52 slidesPerView: "auto", 53 spaceBetween: 25, 54 }, 55 }, 56 lazy: { 57 // tell swiper to load images before they appear 58 loadPrevNext: true, 59 // amount of images to load 60 loadPrevNextAmount: 4, 61 }, 62 }; 63 64}(jQuery)); 65 66var newLaunchesSlider = new $.NewLaunchesSlider(".swiper-newlaunches"); 67newLaunchesSlider.Init(); 68 69
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.