Skip to content

Instantly share code, notes, and snippets.

@djs070
Last active December 15, 2015 06:39
Show Gist options
  • Save djs070/5217630 to your computer and use it in GitHub Desktop.
Save djs070/5217630 to your computer and use it in GitHub Desktop.
// Check whether to do tricky layout
var classesForTrickyLayout = ['node-type-design', 'page-node-enquire', 'page-node-19', 'page-node-20', 'page-user'];
// Check against body classes
var doTrickyLayout = ( $( $('body').attr('class').split(/\s+/) ).filter(classesForTrickyLayout).length > 0 );
if ( doTrickyLayout ) {
$('.fullscreen-background').appendTo($('#content-outer'));
// Resize image
var newWidth = $('#content-outer').width() - $('#content-inner').width();
$(el).width(newWidth);
// Vertical center
var heightDifference = $('#content-outer').height() - $(el).height();
$(el).css('top', Math.min(heightDifference / 2, 0));
// Resize content area (has max and min height set in styles.css)
$('#content-wrapper').height($(el).height() - 60);
// Reinit scroll pane
$('#content-wrapper').jScrollPane();
} else {
// Regular fixed fullsize background
$(this).expandTo($body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment