Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {},
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ <h1>Swipe 2</h1>
// auto: 3000,
// continuous: true,
// disableScroll: true,
// fullscreen: true,
// stopPropagation: true,
// callback: function(index, element) {},
// transitionEnd: function(index, element) {}
Expand All @@ -92,4 +93,4 @@ <h1>Swipe 2</h1>
// with jQuery
// window.mySwipe = $('#mySwipe').Swipe().data('Swipe');

</script>
</script>
21 changes: 19 additions & 2 deletions swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down