integ/js/iri-creation-cinecard.js
changeset 23 3c2416e4daf6
parent 22 5e41bc4feda8
child 25 cc54acb734fb
--- a/integ/js/iri-creation-cinecard.js	Wed Apr 10 11:48:40 2013 +0200
+++ b/integ/js/iri-creation-cinecard.js	Wed Apr 10 12:41:51 2013 +0200
@@ -162,6 +162,26 @@
 				'</a>'+
 			'</li>';
 		$('#videos-more').append(itemVideo);
+		//redimensionnement images
+		$("#videos-more img").each(function() {
+		    var img = $(this),
+		        div = $(this).parent();
+		    img.load(function() {
+		        var iw = img.width(),
+		            ih = img.height(),
+		            dw = div.width(),
+		            dh = div.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
+		        });
+		    });
+		});
 	});
 });