georgepaterson/jquery-videobackground — Issue #9: Always stretch to window height
Author: ursbraem
Created: 2012-02-17 14:22:37+00:00
State: open

Hi George

Thanks for this!

I'd rather have the background adapt seamlessly to the window height. If you have a page with a lot of scrollable text (which is the normal case nowadays), you will expect the background to stay fixed and be able to scroll the stuff in front of that. Cf. your own demo page.

I have made the following changes:
.video-background {
position: fixed;
}

function resize (element) {
var documentHeight = $(document).height(),
windowHeight = $(window).height();
//if (windowHeight >= documentHeight) {
$(element).css('height', windowHeight);
//}
//else if (documentHeight > windowHeight) {
//	$(element).css('height', documentHeight);
//	}
}

... maybe this could be included as an option "resizeTo" (window, document)?

Best regards
Urs