Closed native-apps closed 8 years ago
Sorry you're upset. While your feedback could have been a little bit more constructive, I appreciate your solution but will decline. FitVids employs a CSS based intrinsic resizing technique, not window.resize
, which has its own problems.
Fitvid just isn't good sorry, it doesn't perform well and uses bad methods to fix responsive video. All video objects with height and width can very easily be calculated into ratios with less code and its 100% cross browser ready and doesn't rely on absolute positions and prepending a wrapper lol. It's really becoming a nuisance having to deregister this script from plugins in WP, time after time.... :(
Here is a simple yet fast solution. (Of-course you'' want to target your objects & iframes by their attributes.)
function resizeIframes() { $("iframe, video, .anything").each(function() { var ratio = $(this).attr('height') / $(this).attr('width'); $(this).css('height', $(this).width() * ratio); }); } $(window).on("load resize",function(e) { resizeIframes(); });