Created
          November 5, 2013 23:30 
        
      - 
      
- 
        Save eboyer/7328252 to your computer and use it in GitHub Desktop. 
    Responsive Video
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | responsiveVideosSetup: function(){ | |
| var that = this; | |
| var iframeElement = that.ui.heroWrapper.find('iframe'); | |
| var videoRatio = (iframeElement.height() / iframeElement.width()) * 100; | |
| iframeElement.css({ | |
| 'position':'absolute', | |
| 'top':0, | |
| 'left':0, | |
| 'width':'100%', | |
| 'height':'100%' | |
| }); | |
| var ghost = $('<div></div>'); | |
| ghost.addClass('fluidvids'); | |
| ghost.css({ | |
| 'width':'100%', | |
| 'position':'relative', | |
| 'padding-top':videoRatio + '%' | |
| }); | |
| var thisParent = iframeElement.parent(); | |
| thisParent.prepend(ghost); | |
| ghost.append(iframeElement); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment