diff --git a/README.md b/README.md index b2bc04a..057ed6b 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Swipe can take an optional second parameter– an object of key/value settings: - **continuous** Boolean *(default:true)* - create an infinite feel with no endpoints +- **fullscreen** Boolean *(default:false)* - onclick of the element, container enters fullscreen mode + - **disableScroll** Boolean *(default:false)* - stop any touches on this container from scrolling the page - **stopPropagation** Boolean *(default:false)* - stop event propagation @@ -67,6 +69,7 @@ window.mySwipe = new Swipe(document.getElementById('slider'), { speed: 400, auto: 3000, continuous: true, + fullscreen : true, disableScroll: false, stopPropagation: false, callback: function(index, elem) {}, diff --git a/index.html b/index.html index 196a580..4e3281d 100644 --- a/index.html +++ b/index.html @@ -84,6 +84,7 @@

Swipe 2

// auto: 3000, // continuous: true, // disableScroll: true, + // fullscreen: true, // stopPropagation: true, // callback: function(index, element) {}, // transitionEnd: function(index, element) {} @@ -92,4 +93,4 @@

Swipe 2

// with jQuery // window.mySwipe = $('#mySwipe').Swipe().data('Swipe'); - \ No newline at end of file + diff --git a/swipe.js b/swipe.js index 8b29717..64fec82 100644 --- a/swipe.js +++ b/swipe.js @@ -156,7 +156,20 @@ function Swipe(container, options) { slidePos[index] = dist; } - + + + function fullscreen() { + if (container.requestFullscreen) { + container.requestFullscreen(); + } else if (container.mozRequestFullScreen) { + container.mozRequestFullScreen(); + } else if (container.webkitRequestFullScreen) { + container.webkitRequestFullScreen(); + } else if (container.msRequestFullscreen) { + container.msRequestFullscreen(); + } + } + function translate(index, dist, speed) { var slide = slides[index]; @@ -339,6 +352,10 @@ function Swipe(container, options) { }, end: function(event) { + + if(delta.x === undefined && options.fullscreen == true){ + fullscreen(); + } // measure duration var duration = +new Date - start.time; @@ -444,7 +461,7 @@ function Swipe(container, options) { // add event listeners if (browser.addEventListener) { - + // set touchstart event on element if (browser.touch) element.addEventListener('touchstart', events, false);