File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed
Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 1717 'finalHeight' : null ,
1818 'magnifiedWidth' : null ,
1919 'magnifiedHeight' : null ,
20+ 'touchBottom' : true ,
2021 'limitBounds' : false ,
2122 'mobileCloseEvent' : 'touchstart' ,
2223 'afterLoad' : function ( ) { }
159160 //
160161 // We deduct the positions of .magnify from the mouse or touch positions relative to
161162 // the document to get the mouse or touch positions relative to the container.
162- nX = ( e . pageX || e . originalEvent . touches [ 0 ] . pageX ) - oContainerOffset [ 'left' ] ,
163- nY = ( e . pageY || e . originalEvent . touches [ 0 ] . pageY ) - oContainerOffset [ 'top' ] ;
163+
164+ // Mobile only offset touch point to be at the bottom not on the center
165+ var isMobile = {
166+ Android : function ( ) {
167+ return navigator . userAgent . match ( / A n d r o i d / i) ;
168+ } ,
169+ BlackBerry : function ( ) {
170+ return navigator . userAgent . match ( / B l a c k B e r r y / i) ;
171+ } ,
172+ iOS : function ( ) {
173+ return navigator . userAgent . match ( / i P h o n e | i P a d | i P o d / i) ;
174+ } ,
175+ Opera : function ( ) {
176+ return navigator . userAgent . match ( / O p e r a M i n i / i) ;
177+ } ,
178+ Windows : function ( ) {
179+ return navigator . userAgent . match ( / I E M o b i l e / i) ;
180+ } ,
181+ any : function ( ) {
182+ return ( isMobile . Android ( ) || isMobile . BlackBerry ( ) || isMobile . iOS ( ) || isMobile . Opera ( ) || isMobile . Windows ( ) ) ;
183+ }
184+ } ;
185+ if ( isMobile . any ( ) && oOptions . touchBottom === true ) {
186+ nX = ( e . pageX || e . originalEvent . touches [ 0 ] . pageX ) - oContainerOffset [ 'left' ] ,
187+ nY = ( ( e . pageY || e . originalEvent . touches [ 0 ] . pageY ) - oContainerOffset [ 'top' ] ) - 90 ;
188+ } else {
189+ nX = ( e . pageX || e . originalEvent . touches [ 0 ] . pageX ) - oContainerOffset [ 'left' ] ,
190+ nY = ( e . pageY || e . originalEvent . touches [ 0 ] . pageY ) - oContainerOffset [ 'top' ] ;
191+ }
164192 // Toggle magnifying lens
165193 if ( ! $lens . is ( ':animated' ) ) {
166194 if ( nX > nBoundX && nX < nImageWidth - nBoundX && nY > nBoundY && nY < nImageHeight - nBoundY ) {
You can’t perform that action at this time.
0 commit comments