Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/04/2014, 07:17
quico5
 
Fecha de Ingreso: enero-2008
Mensajes: 580
Antigüedad: 16 años, 4 meses
Puntos: 9
¿puedo combinar load y resize?

Tengo el siguiente código donde repito el código del iframe 2 veces, me gustaría saber si es posible optimizar este código a la mitad de lineas, gracias

Código HTML:
	    $('iframe~*').remove();
      $('iframe').attr('width', '100%').attr('height', $('iframe').width()/16*9).each(function(){
          var url = $(this).attr("src");
          var char = "?";
          if(url.indexOf("?") != -1){
              var char = "&";
          }
          $(this).attr("src",url+char+"wmode=transparent");
      });
      $(window).resize(function(e) {
        $('iframe').attr('width', '100%').attr('height', $('iframe').width()/16*9).each(function(){
            var url = $(this).attr("src");
            var char = "?";
            if(url.indexOf("?") != -1){
                var char = "&";
            }
            $(this).attr("src",url+char+"wmode=transparent");
        });
      });