Parallax Curtain

Parallax Curtain

Hey guys,

I'm really new to JQuery and I am trying to create a Parallax curtain on my blog. I put in a scrollTop Sensor that would change the content from fixed to absolute when the #curtain height reached the top of the window. It works on laptop sized browsers but not on my iMac. I am not sure where I went wrong, but haaaalp! I would appreciate you so much!



$(document).ready(function(){




});

$(window).scroll(function(){

var scrollTop     = $(window).scrollTop();
var curtainHeight = $("div#curtain").height();
var contentHeight = curtainHeight;

$("section").each(function(){

contentHeight = $(this).height();

console.log( $(this).height() );

});

console.log( contentHeight );

$("div#page-wrap").height(contentHeight);

if( scrollTop > ( curtainHeight + 100) ){


$("div#content").css("position", "static");
$("div#content").css("marginTop", ( curtainHeight + 100) );

}else{

$("div#content").css("position", "fixed");
$("div#content").css("marginTop", 0);

}

});