Don't save zoom mode cookie upon window resize
This commit is contained in:
		
							parent
							
								
									84dbc3abff
								
							
						
					
					
						commit
						35d2f8682c
					
				@ -1,5 +1,7 @@
 | 
				
			|||||||
$(function() {
 | 
					$(function() {
 | 
				
			||||||
	function zoom(zoom_type) {
 | 
						function zoom(zoom_type, save_cookie) {
 | 
				
			||||||
 | 
							save_cookie = save_cookie === undefined ? true : save_cookie;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		var img = $('.shm-main-image');
 | 
							var img = $('.shm-main-image');
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if(zoom_type == "full") {
 | 
							if(zoom_type == "full") {
 | 
				
			||||||
@ -21,15 +23,17 @@ $(function() {
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		$(".shm-zoomer").val(zoom_type);
 | 
							$(".shm-zoomer").val(zoom_type);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							if (save_cookie) {
 | 
				
			||||||
			Cookies.set("ui-image-zoom", zoom_type, {expires: 365});
 | 
								Cookies.set("ui-image-zoom", zoom_type, {expires: 365});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$(".shm-zoomer").change(function(e) {
 | 
						$(".shm-zoomer").change(function(e) {
 | 
				
			||||||
		zoom(this.options[this.selectedIndex].value);
 | 
							zoom(this.options[this.selectedIndex].value);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
	$(window).resize(function(e) {
 | 
						$(window).resize(function(e) {
 | 
				
			||||||
		$(".shm-zoomer").each(function (e) {
 | 
							$(".shm-zoomer").each(function (e) {
 | 
				
			||||||
			zoom(this.options[this.selectedIndex].value)
 | 
								zoom(this.options[this.selectedIndex].value, false)
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user