Last active
          December 31, 2015 00:38 
        
      - 
      
- 
        Save plasticut/7908398 to your computer and use it in GitHub Desktop. 
    Fix bootstrap modal body offset bug
  
        
  
    
      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
    
  
  
    
  | function fixModalOffet() { | |
| var el = document.createElement("div"); | |
| el.style.width = "1px"; | |
| el.style.height = "1px"; | |
| el.style.overflow = "scroll"; | |
| el.style.position = "absolute"; | |
| el.style.top = "-9999px"; | |
| document.body.appendChild(el); | |
| var style = document.createElement('style'); | |
| style.type = 'text/css'; | |
| style.innerHTML = ".modal-open, .modal-open .navbar-fixed-top { padding-right: " + ((el.offsetWidth - el.clientWidth) || 15) + "px }"; | |
| document.body.removeChild(el); | |
| document.getElementsByTagName('head')[0].appendChild(style); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment