Created
July 28, 2014 20:03
-
-
Save yojance/cd21a81fb49a3977ada2 to your computer and use it in GitHub Desktop.
This file contains 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
jQuery(document).ready(function() { | |
// Start positioning the #header-ext div | |
wcs_position_header_ext(); | |
}); | |
jQuery( window ).resize( function() { | |
wcs_position_header_ext(); | |
}); | |
// Position the header extension div | |
function wcs_position_header_ext() { | |
// Get the viewport Width | |
var viewport_w = jQuery( window ).width(); | |
// Get the #header-inside Width | |
var header_inside_w = jQuery( '#header-inside .row' ).width(); | |
// Calculate the width of header extension | |
var header_ext_w = ( viewport_w - header_inside_w ) / 2; | |
// Get the Nav's offset from the top | |
var main_nav_offset = jQuery( 'nav.navbar' ).offset(); | |
// Get the header_ext offset from the top | |
var header_ext_offset_value = jQuery( '#header-ext' ).offset(); | |
var header_ext_offset = header_ext_offset_value.top - main_nav_offset.top; | |
// Set the width on the #header-ext div | |
jQuery( '#header-ext' ).css({ 'width' : header_ext_w + 15, 'margin-top' : -header_ext_offset }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment