Slider Revolution WP
09.27.2016
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
(function() { if(!('ontouchend' in document)) return; var pageX, newX; jQuery('body').on('touchstart', function(event) { if(!jQuery('.esgbox-overlay').length) return; var target = jQuery(event.target).attr('class'); event = event.originalEvent; if(event.touches) event = event.touches[0]; pageX = event.pageX; var closing = /esgbox-overlay|esgbox-close/.test(target); if(!closing) return false; }).on('touchmove', function(event) { event = event.originalEvent; if(event.touches) event = event.touches[0]; newX = event.pageX; if(jQuery('.esgbox-overlay').length) event.preventDefault(); }).on('touchend', function(event) { if(!jQuery('.esgbox-overlay').length) return; if(Math.abs(pageX - newX) > 30) { jQuery(pageX > newX ? '.esgbox-next' : '.esgbox-prev').trigger('click'); } }); })(); |
Technically for the JavaScript part to work, the navigation buttons need to be enabled. But we can hide them with some custom CSS manually.
1 2 3 |
@media screen and (max-width: 1024px) {.esgbox-nav {display: none !important}} |