Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fullscreen demo #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Virtually infinite loop-able horizontal carousel for desktop and mobile browsers

Read more at [cubiq.org](http://cubiq.org/swipeview)

FullScreen Demo: [http://bitbonsai.com/swipeview/fullscreen](http://bitbonsai.com/swipeview/fullscreen/)

Gallery Demo: [http://cubiq.org/dropbox/SwipeView/demo/gallery](http://cubiq.org/dropbox/SwipeView/demo/gallery)

eReader Demo: [http://cubiq.org/dropbox/SwipeView/demo/ereader](http://cubiq.org/dropbox/SwipeView/demo/ereader)
Expand Down
104 changes: 104 additions & 0 deletions demo/fullscreen/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

<!doctype html>
<html lang="en" id="base">
<head>
<meta charset="UTF-8">
<title>SwipeView Full Screen Test (images from flickr)</title>
<style>
html {
height: 100%;
}
body{
-webkit-user-select:none;
height: 100%;
padding: 0;
margin: 0;
}

.bg {
min-height: 100%;
background-repeat: no-repeat;
background-position: center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

#wrapper {
height: 100%;
width: 100%;
min-width:320px;
}

</style>
</head>
<body>
<div id="wrapper"></div>
</body>

<!-- include swipeview.js -->
<script src="../../src/swipeview-min.js"></script>
<script>
var carousel,
el,
i,
page,

// this is the key: The image URLs
slides = [
'http://farm4.staticflickr.com/3015/2941486784_acdf85459b_b.jpg',
'http://farm8.staticflickr.com/7077/7300159196_8f8c14049b_b.jpg',
'http://farm6.staticflickr.com/5446/7189851975_139908be4b_b.jpg',
'http://farm8.staticflickr.com/7234/7375094972_06c0933e91_b.jpg',
'http://farm8.staticflickr.com/7356/9661781823_e57543c25d_b.jpg'
];

carousel = new SwipeView('#wrapper', {
numberOfPages: slides.length,
hastyPageFlip: true
});

// Load initial data
for (i = 0; i < 3; i++) {
page = i == 0 ? slides.length - 1 : i - 1;

el = document.createElement('div');
// el.innerHTML = slides[page];
el.className = 'bg';
el.style.backgroundImage = 'url(' + slides[page] + ')';
carousel.masterPages[i].appendChild(el)
}

carousel.onFlip(function () {
var el,
upcoming,
i;

for (i = 0; i < 3; i++) {
upcoming = carousel.masterPages[i].dataset.upcomingPageIndex;

if (upcoming != carousel.masterPages[i].dataset.pageIndex) {
el = carousel.masterPages[i].querySelector('div');
el.className = 'bg';
el.style.backgroundImage = 'url(' + slides[upcoming] + ')';
}
}
});

// also get arrow keys...
document.onkeydown = function() {
switch (window.event.keyCode) {
case 37:
case 38:
window.carousel.prev()
break;
case 39:
case 40:
window.carousel.next()
break;
}
};

</script>
</html>