alcatel/static/js/main.js
changeset 37 3848e1813a30
parent 27 8ca7f2cea729
--- a/alcatel/static/js/main.js	Mon Jul 22 14:56:35 2013 +0200
+++ b/alcatel/static/js/main.js	Wed Aug 14 16:36:41 2013 +0200
@@ -1,3 +1,4 @@
+
 $(function(){
 //CLUSTER
 	var clusterWidth=0;
@@ -73,26 +74,55 @@
 		}
 	});
 	//AFFICHAGE
-	$('.widget.affichage li a').bind('click',function(e){
+	$('.widget.affichage li a').bind('click',function(e)
+	{
 		e.preventDefault();
 		if ($(this).hasClass("treemap") && !$(this).hasClass("active")) {
+
 			$('.widget.affichage li a.liste').removeClass("active");
 			$(this).addClass('active');
-		}else if($(this).hasClass("liste") && !$(this).hasClass("active")){
+			$('#liste').hide();$('#treemap').show();
+			  $(".actu img").each(function() 
+				{
+					
+					var img = $(this),
+						div = $(this).parent();
+						
+					
+						var iw = $(this).width(),
+							ih = $(this).height(),
+							dw = $(this).parent().width(),
+							dh = $(this).parent().height(),
+							scale = Math.max(dw/iw, dh/ih),
+							niw = iw * scale,
+							nih = ih * scale;
+						img.css({
+							width: niw,
+							height: nih,
+							"margin-left": (dw - niw) / 2,
+							"margin-top": (dh - nih) / 3
+						});
+				});
+		}
+		else if($(this).hasClass("liste") && !$(this).hasClass("active")){
+			
 			$('.widget.affichage li a.treemap').removeClass("active");
 			$(this).addClass('active');
+			$('#liste').show();
+			$('#treemap').hide();
+			
 		}
+		//resizeWidgetSidebar();		
 	});
 	
 	
-	
 	//DATE PICKER
 	$(".dateBegin").datepicker({
 		minDate: new Date(2007, 7 - 1, 01),
         maxDate: new Date(2012,12 - 1 , 31),
 		onSelect: function(selectedDate) {
 			$("#pickeddatebegin").val(selectedDate);
-			$("#ajax2").submit();
+			$("#ajaxfiltretreemap").submit();
 			$( "#pickeddateend" ).datepicker( "option", "minDate", selectedDate );
         }
 	});
@@ -101,7 +131,7 @@
         maxDate: new Date(2012, 12 - 1, 31),
 		onSelect: function( selectedDate ) {
 			$("#pickeddateend").val(selectedDate);
-        	$("#ajax2").submit();
+        	$("#ajaxfiltretreemap").submit();
 			$( "#pickeddatebegin" ).datepicker( "option", "maxDate", selectedDate );
         }
 	});