| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | <!--
 | 
					
						
							|  |  |  | TODO: | 
					
						
							|  |  |  | - basic structure | 
					
						
							|  |  |  | 	ribbons | 
					
						
							|  |  |  | 	images | 
					
						
							|  |  |  | 	indicators | 
					
						
							|  |  |  | - basic control elements | 
					
						
							|  |  |  | 	touch zones / buttons | 
					
						
							|  |  |  | 		next | 
					
						
							|  |  |  | 		prev | 
					
						
							|  |  |  | 		shift up | 
					
						
							|  |  |  | 		shift down | 
					
						
							|  |  |  | 		promote | 
					
						
							|  |  |  | 		demote | 
					
						
							|  |  |  | 		zoom in | 
					
						
							|  |  |  | 		zoom out | 
					
						
							|  |  |  | 		toggle single image | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ISSUES: | 
					
						
							|  |  |  | 	- jumping... | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script src="jquery.js"></script> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(document).ready(function() { | 
					
						
							|  |  |  | 	$(".image").click(function(e) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		if($(this).hasClass('current-image')){ | 
					
						
							|  |  |  | 			//return true | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		// switch classes... | 
					
						
							|  |  |  | 		$(this).parents().siblings().children(".image").removeClass("current-image"); | 
					
						
							|  |  |  | 		$(this).siblings(".image").removeClass("current-image"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$(this).siblings().children(".image").removeClass("current-image"); | 
					
						
							|  |  |  | 		$(this).parents().siblings(".ribbon").removeClass("current-ribbon"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$(this).addClass("current-image"); | 
					
						
							|  |  |  | 		$(this).parents(".ribbon").addClass("current-ribbon"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		var container = $(this).parents('.container') | 
					
						
							|  |  |  | 		var field = $(this).parents(".field") | 
					
						
							|  |  |  | 		var cur_ribbon = $(this).parents('.current-ribbon') | 
					
						
							|  |  |  | 		var cur_image = $(this) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		var container_offset = container.offset() | 
					
						
							|  |  |  | 		var ribbon_offset = cur_ribbon.offset() | 
					
						
							|  |  |  | 		var image_offset = cur_image.offset() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		// center the current image... | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		field.animate({ | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 				// XXX need to make these more accurate and robust... | 
					
						
							|  |  |  | 				// XXX this is dependant on size and is really jumpy... | 
					
						
							|  |  |  | 				top: (container_offset.top - ribbon_offset.top + parseInt(field.css('top'))) + (container.innerHeight() - cur_image.outerHeight())/2,  | 
					
						
							|  |  |  | 				left: (container_offset.left - image_offset.left + parseInt(field.css('left'))) + (container.innerWidth() - cur_image.outerWidth())/2  | 
					
						
							|  |  |  | 			}, 300) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		e.preventDefault(); | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// set the default position... | 
					
						
							|  |  |  | 	$('.current-image').click() | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | function prevImage(){ | 
					
						
							|  |  |  | 	$('.current-image').prev('.image').click() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | function nextImage(){ | 
					
						
							|  |  |  | 	$('.current-image').next('.image').click() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  | 	.mock-image { | 
					
						
							|  |  |  | 		position: relative; | 
					
						
							|  |  |  | 		display: inline-block; | 
					
						
							|  |  |  | 		width: 100px; | 
					
						
							|  |  |  | 		height: 60px; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		background: blue; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.container { | 
					
						
							|  |  |  | 		overflow: hidden; | 
					
						
							|  |  |  | 		width: 400px; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		height: 200px; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.field { | 
					
						
							|  |  |  | 		position: relative; | 
					
						
							|  |  |  | 		overflow: visible; | 
					
						
							|  |  |  | 		top: 0px; | 
					
						
							|  |  |  | 		left: -100px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.ribbon { | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		height: 65px; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		width: 2000px; | 
					
						
							|  |  |  | 		overflow: visible; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		padding-top: 2px; | 
					
						
							|  |  |  | 		padding-bottom: 2px; | 
					
						
							|  |  |  | 		/* XXX this kills positioning... */ | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		/* | 
					
						
							|  |  |  | 		text-align: center; | 
					
						
							|  |  |  | 		*/ | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		opacity: 0.2; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.current-image { | 
					
						
							|  |  |  | 		background: red; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.current-ribbon { | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		padding-top: 10px; | 
					
						
							|  |  |  | 		padding-bottom: 10px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		opacity: 1.0; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.current-ribbon .image { | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | </style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="container"> | 
					
						
							|  |  |  | 	<div class="field"> | 
					
						
							|  |  |  | 		<div class="ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 		<div class="ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 		<div class="ribbon current-ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image current-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 		<div class="ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 		<div class="ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | <button onclick="prevImage()">prev</button> | 
					
						
							|  |  |  | <button onclick="nextImage()">next</button> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- vim:set ts=4 sw=4 nowrap : --> |