mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-04 13:20:10 +00:00 
			
		
		
		
	minor edits...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									435d562835
								
							
						
					
					
						commit
						02d05a3cb1
					
				@ -13,6 +13,14 @@ function clickHandler(){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Focus next/prev container element
 | 
				
			||||||
 | 
					* 
 | 
				
			||||||
 | 
					* This will shift focus within a container.
 | 
				
			||||||
 | 
					* 
 | 
				
			||||||
 | 
					* If we reach the start/end of the container, we will "warp" around it 
 | 
				
			||||||
 | 
					* and focus an element from the other end.
 | 
				
			||||||
 | 
					* 
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
function shiftSquare(direction, n){
 | 
					function shiftSquare(direction, n){
 | 
				
			||||||
	if(n == null){
 | 
						if(n == null){
 | 
				
			||||||
		n = 1
 | 
							n = 1
 | 
				
			||||||
@ -25,11 +33,10 @@ function shiftSquare(direction, n){
 | 
				
			|||||||
	if(n == 0){
 | 
						if(n == 0){
 | 
				
			||||||
		return cur
 | 
							return cur
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// see if we need to rotate...
 | 
						// see if we need to warp arund...
 | 
				
			||||||
	if(cur[direction+'All']('.square').length < n){
 | 
						if(cur[direction+'All']('.square').length < n){
 | 
				
			||||||
		var sq = cur.closest('.container').children('.square')
 | 
							var sq = cur.closest('.container').children('.square')
 | 
				
			||||||
		var i = sq.index(cur)
 | 
							var i = sq.index(cur)
 | 
				
			||||||
		// rotate...
 | 
					 | 
				
			||||||
		return focus($(sq[ direction == 'next' 
 | 
							return focus($(sq[ direction == 'next' 
 | 
				
			||||||
								? (i + n) % sq.length 
 | 
													? (i + n) % sq.length 
 | 
				
			||||||
								: sq.length - (Math.abs(i - n) % sq.length) ]))
 | 
													: sq.length - (Math.abs(i - n) % sq.length) ]))
 | 
				
			||||||
@ -37,7 +44,7 @@ function shiftSquare(direction, n){
 | 
				
			|||||||
	// shift the current element...
 | 
						// shift the current element...
 | 
				
			||||||
	return focus($(cur[direction+'All']('.square')[n-1]))
 | 
						return focus($(cur[direction+'All']('.square')[n-1]))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// shift focus left/right...
 | 
					// shift focus left/right wrappers...
 | 
				
			||||||
function next(n){
 | 
					function next(n){
 | 
				
			||||||
	return shiftSquare('next', n) 
 | 
						return shiftSquare('next', n) 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user