page-slider
Version:
A little library to add CSS transitions between pages in a mobile web app.
83 lines (79 loc) • 3 kB
HTML
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width, height=device-height" />
<link rel="stylesheet" href="style.css" charset="utf-8">
<!-- Don't forget to include the CSS file (I forgot when I created this example...) -->
<link rel="stylesheet" href="../lib/page-slider.css">
<title>Page Slider Example</title>
</head>
<body>
<!-- PageSlider depends on jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Here, PageSlider is included via a script tag, but browserify or requirejs are fine, too. -->
<script src="../lib/page-slider.min.js" charset="utf-8"></script>
<!-- The page change logic is in example/script.js -->
<script src="script.js" charset="utf-8"></script>
</body>
</html>
<!-- Page templates, embedded in the file for the sake of simplicity -->
<script id="page-template-1" type="text/template">
<div class="page-1">
<header data-fixed='absolute'>
<a href="#" class="back">←</a>
Fixed Header
</header>
<section>
<h2>Page 1: Scrollable content</h2>
<ul>
<li><a href="#page-2">Go to page 2</a></li>
<li><a href="#page-3">Go to page 3</a></li>
<li><a href="#page-2">Go to page 2</a></li>
<li><a href="#page-3">Go to page 3</a></li>
<li><a href="#page-2">Go to page 2</a></li>
</ul>
</section>
<footer data-fixed='absolute'>
Fixed Footer
</footer>
</div>
</script>
<script id="page-template-2" type="text/template">
<div class="page-2">
<header data-fixed='absolute'>
<a href="#" class="back">←</a>
Fixed Header
</header>
<section>
<h2>Page 2: Other content</h2>
<ul>
<li><a href="#page-3">Go to page 3</a></li>
<li><a href="#page-1">Back to page 1</a></li>
<li><a href="#page-3">Go to page 3</a></li>
<li><a href="#page-1">Back to page 1</a></li>
</ul>
</section>
<footer data-fixed='absolute'>
Fixed Footer
</footer>
</div>
</script>
<script id="page-template-3" type="text/template">
<div class="page-3">
<header data-fixed='absolute'>
<a href="#" class="back">←</a>
Fixed Header
</header>
<section>
<h2>Page 3: Small content</h2>
<ul>
<li><a href="#page-2">Back to page 2</a></li>
<li><a href="#page-1">Go to page 1</a></li>
</ul>
</section>
<footer data-fixed='absolute'>
Fixed Footer
</footer>
</div>
</script>