Advertisement
srikat

Untitled

Feb 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. // Function to automatically set the height of .home-hero to viewport height.
  2. function home_hero_height() {
  3. var barHeight = $('#wpadminbar').outerHeight();
  4. var windowHeight = window.innerHeight;
  5. var newHeight = windowHeight - barHeight;
  6.  
  7. $( '.home-hero' ).css({'height': newHeight + 'px'});
  8. }
  9.  
  10. // http://stackoverflow.com/a/1974797/778809
  11. // Bind to the resize event of the window object
  12. $(window).on("resize", function () {
  13. home_hero_height();
  14. // Invoke the resize event immediately
  15. }).resize();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement