Доброе утро. Вот у меня функция на клик. В среднем через раз пропадает iframe в хром, а в фф нормально отрабатывает.
function run(){
var cod = $(this).next().html() + "<style> *{font-family:\"Consolas\", \"Liberation Mono\", monospace; font-weight:300;} ::selection {color: #000000; background: #CDEAFE;}::-moz-selection {color: #000000; background: #CDEAFE;} img {width: 100%;}</style>";
var hep = $(this).next().height();
var wep = $(this).next().width();
$(this).hide().prev().show().end().next().hide().next().css("height", hep).css("display","block").html('<iframe seamless srcdoc="' + cod.replace(/"/g, "'") + '" width="'+ wep +'" height="'+ hep +'" align="left" frameborder ="no" marginheight="0" marginwidth="0" frameborder="0" vspace="0" hspace="0" scrolling="no"></iframe>');
$(this).next().next().children('iframe').load(function(){
var wev = $(this).parent().width();
var hev = $(this).contents().height();
if($(this).contents().find('iframe:empty').length)
{
$(this).contents().find('iframe').attr('height', wev/16*9).attr('width', wev);
if (hev<wev/16*9)
{
$(this).attr('height', wev/16*9).parent().css("height", wev/16*9);
}
}
else
{
$(this).parent().css("height", hev).end().attr('height', hev).attr('width', wev);
}
});
return false;
};
UPD: Нужно просто убрать "align="left"". Почему-то хром его не кушает.