From 65816a47a459c81d8e90b45662cfe892225bbb14 Mon Sep 17 00:00:00 2001 From: thebest1-92 Date: Wed, 30 Mar 2016 00:08:51 +0300 Subject: [PATCH 1/2] Update jquery.swipebox.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавление класса 'touching' к тегу body один раз значительно увеличивает производительность --- src/js/jquery.swipebox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/jquery.swipebox.js b/src/js/jquery.swipebox.js index f2fd0155..df724d0b 100644 --- a/src/js/jquery.swipebox.js +++ b/src/js/jquery.swipebox.js @@ -296,9 +296,8 @@ bars.addClass( 'visible-bars' ); $this.setTimeout(); - $( 'body' ).bind( 'touchstart', function( event ) { + $( 'body' ).addClass( 'touching' ).bind( 'touchstart', function( event ) { - $( this ).addClass( 'touching' ); index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) ); endCoords = event.originalEvent.targetTouches[0]; startCoords.pageX = event.originalEvent.targetTouches[0].pageX; @@ -911,6 +910,7 @@ closeSlide : function () { $( 'html' ).removeClass( 'swipebox-html' ); $( 'html' ).removeClass( 'swipebox-touch' ); + $('body').removeClass('touching'); $( window ).trigger( 'resize' ); this.destroy(); }, From 1a84d5685a7bc36051d42b423c38fb2871de1c6e Mon Sep 17 00:00:00 2001 From: thebest1-92 Date: Wed, 30 Mar 2016 00:26:22 +0300 Subject: [PATCH 2/2] Update jquery.swipebox.js --- src/js/jquery.swipebox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/jquery.swipebox.js b/src/js/jquery.swipebox.js index df724d0b..ab847e45 100644 --- a/src/js/jquery.swipebox.js +++ b/src/js/jquery.swipebox.js @@ -436,7 +436,7 @@ } ); $( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' ); - $( '.touching' ).off( 'touchmove' ).removeClass( 'touching' ); + $( '.touching' ).off( 'touchmove' ); } ); },