| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | <html> | 
					
						
							|  |  |  | <style> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | .image-block img { | 
					
						
							|  |  |  | 	width: 300px; | 
					
						
							|  |  |  | 	height: auto; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .image-block { | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | 	position: relative; | 
					
						
							| 
									
										
										
										
											2023-07-08 16:51:55 +03:00
										 |  |  | 	width: 1000px;	/* 100px фоточки по три в ряд */ | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .image-block .image input { | 
					
						
							|  |  |  | 	display: none; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | /* | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | .image-block:has(.image input:checked) | 
					
						
							|  |  |  | 		.image:has(input:not(:checked)) { | 
					
						
							|  |  |  | 	opacity: 0.5; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | .image-block:has(.image input:checked) | 
					
						
							|  |  |  | 		.image:has(input:not(:checked)) | 
					
						
							|  |  |  | 		img { | 
					
						
							|  |  |  | 	opacity: 0.5; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | .image-block .image.viewed img { | 
					
						
							|  |  |  | 	position: fixed; | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 	top: 150px; | 
					
						
							|  |  |  | 	left: 300px; | 
					
						
							|  |  |  | 	width: 400px; | 
					
						
							|  |  |  | 	height: auto; | 
					
						
							|  |  |  | 	z-index:1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | </style> | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | var setupGallery = function(gallery){ | 
					
						
							| 
									
										
										
										
											2023-07-08 18:33:50 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// handle clicks.... | 
					
						
							|  |  |  | 	// | 
					
						
							|  |  |  | 	// NOTE: a good way to separate selection and viewing is to use  | 
					
						
							|  |  |  | 	//		evt.shiftKey, i.e: | 
					
						
							|  |  |  | 	//			- normal click sets view mode | 
					
						
							|  |  |  | 	//			- shift+click selects image | 
					
						
							|  |  |  | 	//		and it would be good to implement the expected selection API: | 
					
						
							|  |  |  | 	//			ctrl+a			- select all | 
					
						
							|  |  |  | 	//			ctrl+d			- deselect all | 
					
						
							|  |  |  | 	//			arrows			- navigation | 
					
						
							|  |  |  | 	//			shift+arrows	- navigation selection | 
					
						
							|  |  |  | 	//			... | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | 	gallery.addEventListener('click', function(evt){ | 
					
						
							|  |  |  | 		var target = evt.target | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 18:33:50 +03:00
										 |  |  | 		//console.log('--- EVENT:', evt) | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if(target.tagName.toLowerCase() == 'img'){ | 
					
						
							|  |  |  | 			var clicked = target | 
					
						
							|  |  |  | 			// get the "image" element... | 
					
						
							|  |  |  | 			while(!clicked.classList.contains('image')){ | 
					
						
							|  |  |  | 				clicked = clicked.parentElement | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// keep only one image "viewed"... | 
					
						
							|  |  |  | 			for(var img of gallery.querySelectorAll('.viewed')){ | 
					
						
							|  |  |  | 				// skip clicked image... | 
					
						
							|  |  |  | 				if(img === clicked){ | 
					
						
							|  |  |  | 					continue | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				img.classList.remove('viewed') | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// toggle state... | 
					
						
							|  |  |  | 			clicked.classList.toggle('viewed') | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}) | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | var setup = function(){ | 
					
						
							|  |  |  | 	var galleries = document.body.querySelectorAll('.image-block') | 
					
						
							|  |  |  | 	for(var gallery of galleries){ | 
					
						
							|  |  |  | 		setupGallery(gallery) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 	 | 
					
						
							|  |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | <body onload="setup()"> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | <div class="wishes"> | 
					
						
							| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | 	<div> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 		<h2>for functionality</h2> | 
					
						
							|  |  |  | 		<ul> | 
					
						
							|  |  |  | 			<li>Add drag n drop  | 
					
						
							|  |  |  | 				<br>(full page is a drop space)</li>		 | 
					
						
							|  |  |  | 			<li>Add add tags</li>  | 
					
						
							|  |  |  | 			<li>Add "search" (tag/tags)</li>		 | 
					
						
							|  |  |  | 			<li>Add pick up a photo</li>  | 
					
						
							|  |  |  | 			<li>...</li>	 | 
					
						
							|  |  |  | 		</ul> | 
					
						
							| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | 	</div> | 
					
						
							|  |  |  | 	<div> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | 		<h2>for style</h2>	 | 
					
						
							|  |  |  | 		<ul> | 
					
						
							|  |  |  | 			<li>Gallery w 5-6 photos (flex w size) in a row, | 
					
						
							|  |  |  | 					<br>wich is nice to scroll down</li>		 | 
					
						
							|  |  |  | 			<li>Arrows to see next/prev photo</li>  | 
					
						
							|  |  |  | 			<li>Fantom next/prev photos on the background</li>		 | 
					
						
							|  |  |  | 			<li>...</li>  | 
					
						
							|  |  |  | 		</ul> | 
					
						
							| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | 	</div> | 
					
						
							| 
									
										
										
										
											2023-07-08 15:53:20 +03:00
										 |  |  | </div> | 
					
						
							|  |  |  | <input type="file" id="input" multiple> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="image-block"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/1.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/2.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/3.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/4.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/5.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<label class="image"> | 
					
						
							|  |  |  | 		<input type="checkbox"> | 
					
						
							|  |  |  | 		<img src="images/6.JPG"> | 
					
						
							|  |  |  | 	</label> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | </body> | 
					
						
							| 
									
										
										
										
											2023-06-23 15:27:39 +08:00
										 |  |  | </html> | 
					
						
							| 
									
										
										
										
											2023-07-08 16:38:14 +03:00
										 |  |  | <!-- vim:set ts=4 sw=4 : --> |