|
1 | | -/*! Swipebox v1.2.6 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */ |
| 1 | +/*! Swipebox v1.2.7 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */ |
2 | 2 |
|
3 | 3 | ;( function ( window, document, $, undefined ) { |
4 | 4 |
|
|
20 | 20 | selector = elem.selector, |
21 | 21 | $selector = $( selector ), |
22 | 22 | isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ), |
| 23 | + isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints, |
23 | 24 | supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', "svg").createSVGRect, |
24 | 25 | winWidth = window.innerWidth ? window.innerWidth : $( window ).width(), |
25 | 26 | winHeight = window.innerHeight ? window.innerHeight : $( window ).height(), |
|
50 | 51 |
|
51 | 52 | $( document ).on( 'click', selector, function( event ) { |
52 | 53 |
|
| 54 | + // console.log( isTouch ); |
| 55 | + |
53 | 56 | if ( event.target.parentNode.className === 'slide current' ) { |
54 | 57 |
|
55 | 58 | return false; |
|
181 | 184 | $this.setDim(); |
182 | 185 | $this.actions(); |
183 | 186 |
|
184 | | - if ( isMobile ) { |
| 187 | + if ( isTouch ) { |
185 | 188 | $this.gesture(); |
186 | 189 | } else { |
187 | 190 | $this.keyboard(); |
|
401 | 404 | } |
402 | 405 | } ); |
403 | 406 |
|
404 | | - if ( ! isMobile ) { |
| 407 | + if ( ! isTouch ) { |
405 | 408 |
|
406 | 409 | $( '#swipebox-action' ).hover( function() { |
407 | 410 | $this.showBars(); |
|
448 | 451 | actions : function () { |
449 | 452 | var $this = this; |
450 | 453 |
|
451 | | - var action = isMobile ? 'touchend' : 'click'; |
| 454 | + var action = isTouch ? 'touchend' : 'click'; |
452 | 455 |
|
453 | 456 | if ( elements.length < 2 ) { |
454 | 457 |
|
|
511 | 514 | */ |
512 | 515 | openSlide : function ( index ) { |
513 | 516 | $( 'html' ).addClass( 'swipebox-html' ); |
514 | | - if ( isMobile ) { |
| 517 | + if ( isTouch ) { |
515 | 518 | $( 'html' ).addClass( 'swipebox-touch' ); |
516 | 519 | } |
517 | 520 | $( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop |
|
0 commit comments