1/* 2 * 2021 NUX.codes 3 * @author NUX.codes <[email protected]> 4 * 5 */ 6//$(window).load(function(){ 7$(function(){ 8 //Detect if screen resolution changes 9 //let widthScreen = screen.width+'px'; 10 let widthScreen = $(window).width()+'px'; 11 12 $('.bxslider').bxSlider({ 13 auto: true, 14 autoStart: true, 15 stopAutoOnClick: true, 16 speed: homeslider_speed, 17 pause: homeslider_pause, 18 randomStart: false, 19 20 // Desactivar control táctil 21 touchEnabled: false, 22 preventDefaultSwipeX: false, 23 preventDefaultSwipeY: false, 24 25 // Activar controles visibles 26 controls: true, // flechas 27 pager: true, // dots 28 adaptiveHeight: false, 29 responsive: true, 30 31 // Permitir clicks en los enlaces dentro de slides 32 onSlideAfter: function(){ 33 $('.bxslider a').css('pointer-events', 'auto'); 34 }, 35 onSlideBefore: function(){ 36 $('.bxslider a').css('pointer-events', 'none'); 37 } 38 }); 39 40 41 //Adapts screen resolution to the slide 42 //$('.bxslider').css({'display':'inline!important','transform':'translate3d(-'+widthScreen+', 0px, 0px)'}); //Set initial transform 43 $('.bxslider li').css('width',widthScreen); 44 45 /* Disable BX default elements or attributes*/ 46 $('.bx-wrapper').css({'border':'0','box-shadow':'none','-webkit-box-shadow':'none','-moz-box-shadow':'none'}) 47 // $('.bx-controls').css('display','none'); 48 49 $('.slider_full_container .bxslider').click(function(){ 50 // console.log('clicked'); 51 }); 52 /** 53 * Event handler for "touchmove" 54 * 55 * @param e (event) 56 * - DOM event object 57 */ 58 var onTouchMove = function(e){ 59 // e.preventDefault(); 60 // if(slider.settings.mode != 'fade'){ 61 // var orig = e.originalEvent; 62 var orig = e.originalEvent; 63 // if scrolling on y axis, do not prevent default 64 var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x); 65 var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y); 66 // x axis swipe 67 if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){ 68 e.preventDefault(); 69 // y axis swipe 70 }else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){ 71 e.preventDefault(); 72 } 73 if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){ 74 var value = 0; 75 // if horizontal, drag along x axis 76 if(slider.settings.mode == 'horizontal'){ 77 var change = orig.changedTouches[0].pageX - slider.touch.start.x; 78 value = slider.touch.originalPos.left + change; 79 // if vertical, drag along y axis 80 }else{ 81 var change = orig.changedTouches[0].pageY - slider.touch.start.y; 82 value = slider.touch.originalPos.top + change; 83 } 84 setPositionProperty(value, 'reset', 0); 85 } 86 } 87 88 /** 89 * Event handler for "touchend" 90 * 91 * @param e (event) 92 * - DOM event object 93 */ 94 var onTouchEnd = function(e){ 95 slider.viewport.unbind('touchmove', onTouchMove); 96 var orig = e.originalEvent; 97 var value = 0; 98 // record end x, y positions 99 slider.touch.end.x = orig.changedTouches[0].pageX; 100 slider.touch.end.y = orig.changedTouches[0].pageY; 101 // if fade mode, check if absolute x distance clears the threshold 102 if(slider.settings.mode == 'fade'){ 103 var distance = Math.abs(slider.touch.start.x - slider.touch.end.x); 104 if(distance >= slider.settings.swipeThreshold){ 105 slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide(); 106 el.stopAuto(); 107 } 108 // not fade mode 109 }else{ 110 var distance = 0; 111 // calculate distance and el's animate property 112 if(slider.settings.mode == 'horizontal'){ 113 distance = slider.touch.end.x - slider.touch.start.x; 114 value = slider.touch.originalPos.left; 115 }else{ 116 distance = slider.touch.end.y - slider.touch.start.y; 117 value = slider.touch.originalPos.top; 118 } 119 // if not infinite loop and first / last slide, do not attempt a slide transition 120 if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){ 121 setPositionProperty(value, 'reset', 200); 122 }else{ 123 // check if distance clears threshold 124 if(Math.abs(distance) >= slider.settings.swipeThreshold){ 125 distance < 0 ? el.goToNextSlide() : el.goToPrevSlide(); 126 el.stopAuto(); 127 }else{ 128 // el.animate(property, 200); 129 setPositionProperty(value, 'reset', 200); 130 } 131 } 132 } 133 slider.viewport.unbind('touchend', onTouchEnd); 134 } 135}); 136window.onload = function () { 137 var element = document.getElementById('slider_video'); 138 element.muted = "muted"; 139}
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.