var els = $('.address_row');
els.each(function(index){
var el = els.eq(index);
var prevCont = el.closest('.squeeze_template');
if(prevCont.length < 1){ return false; } var map=prevCont.find('#map'); var roffset=(prevCont.width() - (el.offset().left - prevCont.offset().left + el.outerWidth())); console.log('prevCont.width()',prevCont.width()); console.log('el.offset().left',el.offset().left); console.log('prevCont.offset().left',prevCont.offset().left); var leftwidth=el.width()/2 + roffset; var allwidth=leftwidth*2; var toffset=(el.offset().top - prevCont.offset().top) - 100; var allheight=toffset*2; map.css('width',allwidth); map.css('height',allheight); window.setSizePresent=true; });