Last active
April 17, 2019 23:17
-
-
Save zeshanshani/77288a7701bcf1dd5870356cb46b00c4 to your computer and use it in GitHub Desktop.
This JavaScript function will expand the sections to the 100% of browser window height.
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
/** | |
* Full Height Sections | |
* This function will expand the sections to the 100% of browser window height. | |
* | |
* Author: Zeshan Ahmed | |
* Author URI: http://www.zeshanahmed.com/ | |
* | |
* Replace '#banner' with your targeted element's selector. | |
*/ | |
jQuery(document).ready(function($) { | |
fullHeightSectionsContainer( '#banner' ); | |
}); | |
function fullHeightSectionsContainer( _el ) { | |
var _win = jQuery(window), | |
_wpadminbar = jQuery('#wpadminbar'); | |
function fullHeightSections( _sec ) { | |
var _winThis = jQuery(window); | |
jQuery(_sec).each(function( i ) { | |
var _this = jQuery(this), | |
height = _win.outerHeight() - _wpadminbar.outerHeight(); | |
_this.css( 'height', height ); | |
}); | |
} | |
_win.ready(function() { | |
fullHeightSections( _el ); | |
}).resize(function() { | |
fullHeightSections( _el ); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment