I have a small piece of JQuery designed to collapse my header, change its dimensions, and then stick it to the side of the screen. It all works apart from one part, the heig
look at jquery's one() functionality http://api.jquery.com/one/
It will only fire once and then promptly remove itself..
use a flag to check it is first time or not
var doHeightToggle=true;
$.event.add(window, "scroll", function() {
if(doHeightToggle)
{
var p = $(window).scrollTop();
$(div).css('position',((p)>start) ? 'fixed' : 'static');
$(div).css('top',((p)>start) ? '0px' : '');
doHeightToggle = false;
}
});