[wp-trac] [WordPress Trac] #25390: Autoembeds - preserve embed ratio on responsive designs

WordPress Trac noreply at wordpress.org
Mon Sep 23 17:18:41 UTC 2013


#25390: Autoembeds - preserve embed ratio on responsive designs
-------------------------+------------------------------
 Reporter:  Looimaster   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  3.6.1
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by Looimaster):

 I don't know but it doesn't look nice that it doesn't maintain the correct
 ratio. I use this on window resize and it works:

 {{{
 jQuery('.content-area > article iframe').each(function(){
         var width = jQuery(this).attr('width');
         var height = jQuery(this).attr('height');
         if(width && height){
                 var current_width = jQuery(this).width();
                 var current_height = jQuery(this).height();
                 var current_ratio = current_width/current_height;
                 var ratio = width/height;
                 if(ratio != current_ratio){
                         jQuery(this).height((jQuery(this).width() *
 height)/width);
                 }
         }
 });

 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25390#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list