Skip to content

Commit

Permalink
Update jquery.bxslider.js
Browse files Browse the repository at this point in the history
stevenwanderski#1109 remove e.preventDefault();
to fix click on link in slider + mobile + chrome
solution for
stevenwanderski#1240
  • Loading branch information
martin-tuma committed Mar 21, 2024
1 parent 80b5a47 commit d0d0a67
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/js/jquery.bxslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
onSlideNext: function() { return true; },
onSlidePrev: function() { return true; },
onSliderResize: function() { return true; },
onAutoChange: function() { return true; } //calls when auto slides starts and stops
onAutoChange: function() { return true; } //calls when auto slides starts and stops
};

$.fn.bxSlider = function(options) {
Expand Down Expand Up @@ -256,13 +256,13 @@
slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
// if video is true, set up the fitVids plugin
if (slider.settings.video) { el.fitVids(); }
//preloadImages
if (slider.settings.preloadImages === 'none') {
preloadSelector = null;
}
else if (slider.settings.preloadImages === 'all' || slider.settings.ticker) {
preloadSelector = slider.children;
}
//preloadImages
if (slider.settings.preloadImages === 'none') {
preloadSelector = null;
}
else if (slider.settings.preloadImages === 'all' || slider.settings.ticker) {
preloadSelector = slider.children;
}
// only check for control addition if not in "ticker" mode
if (!slider.settings.ticker) {
// if controls are requested, add them
Expand All @@ -277,7 +277,7 @@
} else {
slider.settings.pager = false;
}
if (preloadSelector === null) {
if (preloadSelector === null) {
start();
} else {
loadElements(preloadSelector, start);
Expand Down Expand Up @@ -487,7 +487,7 @@
breakPoint = counter + getNumberSlidesShowing();
counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
}
return counter;
return counter;
}
// if moveSlides is 0 (auto) divide children length by sides showing, then round up
} else {
Expand Down Expand Up @@ -907,9 +907,9 @@
}
}
};
/* auto start and stop functions */
var windowFocusHandler = function() { el.startAuto(); };
var windowBlurHandler = function() { el.stopAuto(); };
/* auto start and stop functions */
var windowFocusHandler = function() { el.startAuto(); };
var windowBlurHandler = function() { el.stopAuto(); };
/**
* Initializes the auto process
*/
Expand Down Expand Up @@ -1106,7 +1106,7 @@
if (e.type !== 'touchstart' && e.button !== 0) {
return;
}
e.preventDefault();

//disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
slider.controls.el.addClass('disabled');

Expand All @@ -1117,12 +1117,12 @@
slider.touch.originalPos = el.position();
var orig = e.originalEvent,
touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
var chromePointerEvents = typeof PointerEvent === 'function';
if (chromePointerEvents) {
if (orig.pointerId === undefined) {
return;
}
}
var chromePointerEvents = typeof PointerEvent === 'function';
if (chromePointerEvents) {
if (orig.pointerId === undefined) {
return;
}
}
// record the starting touch x, y coordinates
slider.touch.start.x = touchPoints[0].pageX;
slider.touch.start.y = touchPoints[0].pageY;
Expand Down Expand Up @@ -1486,21 +1486,21 @@
el.goToNextSlide = function() {
// if infiniteLoop is false and last page is showing, disregard call
if (!slider.settings.infiniteLoop && slider.active.last) { return; }
if (slider.working === true){ return ;}
var pagerIndex = parseInt(slider.active.index) + 1;
el.goToSlide(pagerIndex, 'next');
};
if (slider.working === true){ return ;}
var pagerIndex = parseInt(slider.active.index) + 1;
el.goToSlide(pagerIndex, 'next');
};

/**
* Transitions to the prev slide in the show
*/
el.goToPrevSlide = function() {
// if infiniteLoop is false and last page is showing, disregard call
if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
if (slider.working === true){ return ;}
var pagerIndex = parseInt(slider.active.index) - 1;
el.goToSlide(pagerIndex, 'prev');
};
if (slider.working === true){ return ;}
var pagerIndex = parseInt(slider.active.index) - 1;
el.goToSlide(pagerIndex, 'prev');
};

/**
* Starts the auto show
Expand All @@ -1519,8 +1519,8 @@
el.goToPrevSlide();
}
}, slider.settings.pause);
//allback for when the auto rotate status changes
slider.settings.onAutoChange.call(el, true);
//allback for when the auto rotate status changes
slider.settings.onAutoChange.call(el, true);
// if auto controls are displayed and preventControlUpdate is not true
if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
};
Expand All @@ -1539,8 +1539,8 @@
// clear the interval
clearInterval(slider.interval);
slider.interval = null;
//allback for when the auto rotate status changes
slider.settings.onAutoChange.call(el, false);
//allback for when the auto rotate status changes
slider.settings.onAutoChange.call(el, false);
// if auto controls are displayed and preventControlUpdate is not true
if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
};
Expand Down Expand Up @@ -1637,8 +1637,8 @@
if (slider.settings.keyboardEnabled) { $(document).off('keydown', keyPress); }
//remove self reference in data
$(this).removeData('bxSlider');
// remove global window handlers
$(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
// remove global window handlers
$(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
};

/**
Expand Down

0 comments on commit d0d0a67

Please sign in to comment.