Last active
          December 26, 2015 08:39 
        
      - 
      
- 
        Save mhkeller/7123958 to your computer and use it in GitHub Desktop. 
    Document Cloud Responsiveness Hack. Sets height of viewer on page load based on screen width.
  
        
  
    
      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
    
  
  
    
  | <div id="DV-viewer-<THE ID OF YOUR DOCUMENT>" class="DV-container"></div> | |
| <script src="//s3.amazonaws.com/s3.documentcloud.org/viewer/loader.js"></script> | |
| <script> | |
| var dcloud_width = (window.innerWidth > 0) ? window.innerWidth : screen.width; | |
| var dcloud_height; | |
| var dcloud_opts = { | |
| sidebar: true, | |
| text: false, | |
| pdf: false, | |
| container: "#DV-viewer-<THE ID OF YOUR DOCUMENT>" | |
| } | |
| if (dcloud_width < 500){ | |
| dcloud_width = dcloud_width - 40; | |
| dcloud_height = 400; | |
| }else{ | |
| dcloud_width = 590; | |
| dcloud_height = 725; | |
| }; | |
| dcloud_opts.width = dcloud_width; | |
| dcloud_opts.height = dcloud_height; | |
| DV.load("//www.documentcloud.org/documents/<THE ID OF YOUR DOCUMENT>.js", dcloud_opts); | |
| </script> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment