Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung | |||
region [2018/09/25 22:30] – admin | region [2018/09/25 22:31] (aktuell) – admin | ||
---|---|---|---|
Zeile 7: | Zeile 7: | ||
<iframe width=" | <iframe width=" | ||
- | |||
- | <script src=" | ||
- | < | ||
- | // Find all YouTube videos | ||
- | var $allVideos = $(" | ||
- | |||
- | // The element that is fluid width | ||
- | $fluidEl = $(" | ||
- | |||
- | // Figure out and save aspect ratio for each video | ||
- | $allVideos.each(function() { | ||
- | |||
- | $(this) | ||
- | .data(' | ||
- | |||
- | // and remove the hard coded width/ | ||
- | .removeAttr(' | ||
- | .removeAttr(' | ||
- | |||
- | }); | ||
- | |||
- | // When the window is resized | ||
- | $(window).resize(function() { | ||
- | |||
- | var newWidth = $fluidEl.width(); | ||
- | |||
- | // Resize all videos according to their own aspect ratio | ||
- | $allVideos.each(function() { | ||
- | |||
- | var $el = $(this); | ||
- | $el | ||
- | .width(newWidth) | ||
- | .height(newWidth * $el.data(' | ||
- | |||
- | }); | ||
- | |||
- | // Kick off one resize to fix all videos on page load | ||
- | }).resize(); | ||
- | </ | ||
</ | </ | ||