Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá amigos, estou tentando fazer isso como o jQuery mas não está dando certo :/ já tentei de tudo e não sei o que está errado.
Alguém ai poderia dar uma ajuda?
Segue o script
$(document).ready(function() {
$("#gerarwidget").bind("change keyup", function() {
// Dados
var cat = $("select[name=cat] option:selected").val();
var lin = $("select[name=lin] option:selected").val();
var img = $("select[name=img] option:selected").val();
// Dados2
var height = tamanho;
/ ----- Dimensoes ----- /
// Width
if(lin == 1 && img == 1) {
var width = tamanho;
var height = tamanho;
}
else if(lin == 1 && img > 1) {
var width = (tamanho * img) + (img * 10);
var height = tamanho;
}
else if(lin > 1 && img == 1) {
var width = tamanho;
var height = (tamanho * lin) + (img * 10);
} var width = (tamanho * img) + (img * 10);
var height = (tamanho * lin) + (img * 10);
}
/ ----- Dimensões ----- /
// Gera o código do Text Area
$("#codigowidget").text('<iframe frameborder="0" style="background:none;" width="' + width + '" height="' + height + '" src="http://www.site.com/widget.php?&cat=' + cat + '&lin=' + lin + '&img=' + img + '" scrolling="no"></iframe>');
// Gera o preview
$("#preview").html('<iframe frameborder="0" style="background:none;" width="' + width + '" height="' + height + '" src="http://www.site.com/widget.php?&cat=' + cat + '&lin=' + lin + '&img=' + img + '" scrolling="no"></iframe>');
// Dimensoes Width x Height
$("#dimensoes").html("Dimensões: <b>" + width + "x" + height + "</b>");
});
$("#gerarwidget").trigger("change");
});Carregando comentários...