mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-11-04 05:50:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			152 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			152 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
<html>
 | 
						|
<head>
 | 
						|
<title>layout template</title>
 | 
						|
<link rel="stylesheet" href="layout.css">
 | 
						|
<script src="jquery.js"></script>
 | 
						|
<script src="jquery.touchSwipe.js"></script>
 | 
						|
<script src="jquery.exif.js"></script>
 | 
						|
 | 
						|
<script>
 | 
						|
 | 
						|
$(document).ready(function(){
 | 
						|
	$('.article').click(function(){
 | 
						|
		var name = $(this).attr('id')
 | 
						|
		return setPageTo(name)
 | 
						|
	})
 | 
						|
 | 
						|
	$('.viewer')
 | 
						|
		//.click(toggleIndex)
 | 
						|
		.swipe({
 | 
						|
			swipeLeft: nextPage,
 | 
						|
			swipeRight: prevPage,
 | 
						|
			swipeUp: showIndex,
 | 
						|
			swipeDown: hideIndex
 | 
						|
		})
 | 
						|
})
 | 
						|
 | 
						|
 | 
						|
 | 
						|
function getPages(){
 | 
						|
	return $('.article').map(function(e, v){return v.id}).toArray()
 | 
						|
}
 | 
						|
 | 
						|
function curPageIndex(){
 | 
						|
	var cur = $('.article.current').attr('id')
 | 
						|
	return getPages().indexOf(cur)
 | 
						|
}
 | 
						|
 | 
						|
function setPageTo(name){
 | 
						|
	$('.view.current, .article.current').removeClass('current')
 | 
						|
	$('#'+name).addClass('current')
 | 
						|
	$('.view.'+name).addClass('current')
 | 
						|
	return false
 | 
						|
}
 | 
						|
 | 
						|
function nextPage(){
 | 
						|
	var i = curPageIndex()
 | 
						|
	var pages = getPages()
 | 
						|
 | 
						|
	if(i+1 >= pages.length){
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	setPageTo(pages[i+1])
 | 
						|
}
 | 
						|
 | 
						|
function prevPage(){
 | 
						|
	var i = curPageIndex()
 | 
						|
 | 
						|
	if(i <= 0){
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	setPageTo(getPages()[i-1])
 | 
						|
}
 | 
						|
 | 
						|
function showIndex(){
 | 
						|
	//$('.previews').fadeIn()
 | 
						|
	$('.previews').slideDown(100)
 | 
						|
}
 | 
						|
 | 
						|
function hideIndex(){
 | 
						|
	//$('.previews').fadeOut()
 | 
						|
	$('.previews').slideUp(100)
 | 
						|
}
 | 
						|
 | 
						|
function toggleIndex(){
 | 
						|
	if($('.previews').css('display') == 'none'){
 | 
						|
		showIndex()
 | 
						|
	} else {
 | 
						|
		hideIndex()
 | 
						|
	}
 | 
						|
	return false
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
</script>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
	<div class="container">
 | 
						|
		<div class="content">
 | 
						|
			<div class="section main current">
 | 
						|
				<div class="viewer">
 | 
						|
					<div class="view A current">
 | 
						|
						<h1>Page A</h1>
 | 
						|
						<p>
 | 
						|
						The basic actions here are:<br>
 | 
						|
						<br><b>swipe right</b> – show next page.
 | 
						|
						<br><b>swipe left</b> – show previous page.
 | 
						|
						<br><b>swipe up</b> – show page index.
 | 
						|
						<br><b>swipe down</b> – hide page index.
 | 
						|
						</p>
 | 
						|
					</div>
 | 
						|
					<div class="view B">
 | 
						|
						<div style="height: 95%; width: 95%; margin: 2%; border: 5px dotted gray;">
 | 
						|
							<h2>Page B</h2>
 | 
						|
						</div>
 | 
						|
 | 
						|
					</div>
 | 
						|
					<div class="view C">
 | 
						|
						<h2>Page C</h2>
 | 
						|
						<!-- images need caching... -->
 | 
						|
						<!--img src="img.jpg" exif="true" onclick="alert($(this).exifPretty())"/-->
 | 
						|
						<img src="img.jpg"/>
 | 
						|
					</div>
 | 
						|
					<div class="view D">
 | 
						|
						<h2>Page D</h2>
 | 
						|
					</div>
 | 
						|
				</div>
 | 
						|
				<!-- remove this... -->
 | 
						|
				<div class="previews">
 | 
						|
					<div class="article current" id="A">
 | 
						|
						<div class="preview"></div>
 | 
						|
						<div class="text">
 | 
						|
							Article A Title
 | 
						|
						</div>
 | 
						|
					</div>
 | 
						|
					<div class="article" id="B">
 | 
						|
						<div class="preview"></div>
 | 
						|
						<div class="text">
 | 
						|
							Article B Title
 | 
						|
						</div>
 | 
						|
					</div>
 | 
						|
					<div class="article" id="C">
 | 
						|
						<div class="preview"></div>
 | 
						|
						<div class="text">
 | 
						|
							Article C Title
 | 
						|
						</div>
 | 
						|
					</div>
 | 
						|
					<div class="article" id="D">
 | 
						|
						<div class="preview"></div>
 | 
						|
						<div class="text">
 | 
						|
							Article D Title
 | 
						|
						</div>
 | 
						|
					</div>
 | 
						|
				</div>
 | 
						|
			</div>
 | 
						|
		</div>
 | 
						|
	</div>
 | 
						|
<!-- vim:set ts=4 sw=4 spell : -->
 | 
						|
</body>
 | 
						|
</html>
 |