Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

46 lines
1.0KB

  1. (function($){
  2. $(function(){
  3. $('.button-collapse').sideNav();
  4. }); // end of document ready
  5. })(jQuery); // end of jQuery name space
  6. function resizeYoutubeVideo(){
  7. // Find all YouTube videos
  8. var $allVideos = $("iframe[src^='//www.youtube.com']"),
  9. // The element that is fluid width
  10. $fluidEl = $("#videowraper");
  11. // Figure out and save aspect ratio for each video
  12. $allVideos.each(function() {
  13. $(this)
  14. .data('aspectRatio', this.height / this.width)
  15. // and remove the hard coded width/height
  16. .removeAttr('height')
  17. .removeAttr('width');
  18. });
  19. // When the window is resized
  20. $(window).resize(function() {
  21. var newWidth = $fluidEl.width();
  22. // Resize all videos according to their own aspect ratio
  23. $allVideos.each(function() {
  24. var $el = $(this);
  25. $el
  26. .width(newWidth)
  27. .height(newWidth * $el.data('aspectRatio'));
  28. });
  29. // Kick off one resize to fix all videos on page load
  30. }).resize();
  31. }