Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Last active December 21, 2015 00:39
Show Gist options
  • Save jakecraige/6222314 to your computer and use it in GitHub Desktop.
Save jakecraige/6222314 to your computer and use it in GitHub Desktop.
Set backstretch image of page from image content type in drupal, and change css on scroll down
function commercial_backstretch_setup() {
if($('.node-type-commercial-development').length > 0) {
var image = $('#content .field-image img').attr('src');
$('body').backstretch(image);
var height = $(window).scrollTop() - $('#testimonial_wrapper').offset().top
if(height > $('#content').height()) {
$('#content').height(height * -1);
}
}
}
@jakecraige
Copy link
Author

First if statement was used to prevent it from happening on a specific page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment