# HG changeset patch # User Anthony Ly # Date 1365591706 -7200 # Node ID cc54acb734fb1ae69e67a10236a4c5477c578077 # Parent feb0342a166ff4b2eefc91284277b621cc6a15f0 update image resize diff -r feb0342a166f -r cc54acb734fb integ/css/iri.css --- a/integ/css/iri.css Wed Apr 10 12:51:35 2013 +0200 +++ b/integ/css/iri.css Wed Apr 10 13:01:46 2013 +0200 @@ -36,8 +36,8 @@ .videos.less{height: 76px; overflow: hidden;} .videos li:nth-child(3n+3) { margin-right: 0;} -.videos li a{width: 80px; height: 80px;} -.videos li{overflow: hidden;margin: 0 8px 10px 0;width: 80px; height: 64px;border: 1px solid #767676; float: left;} +.videos li a{width: 80px; height: 64px;} +.videos li{overflow: hidden;margin: 0 8px 10px 0;border: 1px solid #767676; float: left;} .renkan{ position: relative;display: table-cell; padding-top:60px; vertical-align: top; background-color: #eee; width:100%; background: url(../img/bg-renkan.png) 0 0; min-width: 400px;} .renkan .wrap-top{width: 100%; height: 56px; background-color:rgba(0,0,0,.4);} diff -r feb0342a166f -r cc54acb734fb integ/js/iri-creation-cinecard.js --- a/integ/js/iri-creation-cinecard.js Wed Apr 10 12:51:35 2013 +0200 +++ b/integ/js/iri-creation-cinecard.js Wed Apr 10 13:01:46 2013 +0200 @@ -123,26 +123,7 @@ ''; $('#images-more').append(itemImagess); }); - //redimensionnement images - $("#images-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 - }); - }); - }); + resizeImg('#images-more'); });//get //-- trailer @@ -162,29 +143,33 @@ ''+ ''; $('#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 - }); - }); - }); + resizeImg('#videos-more'); }); }); + +function resizeImg(parentId){ + $(parentId+" 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 + }); + }); + }); +} + //TOOLTIP var show_tooltip_info_iri = function(elem){ var tooltip = $('.rate_tooltip'),