As a newcomer to jQuery, I've been making progress but have hit a roadblock with this code:
$(window).scroll(function(){
var $header = $('#header');
var $st = $(this).scrollTop();
console.log($st);
if ($st < 250) {
console.log($st);
$header.height(300 - $st);
} else {
$header.hover(function(){
$(this).height(300);
}, function (){
$(this).height(50);
});
}
}).scroll();
Although everything seems to be functioning correctly, with the 'header' scaling down on scroll and expanding and contracting on hover, I have encountered a bug. After scrolling down and returning to the top of the page, the header shrinks to .height(50) on hover, even though it is supposed to only happen when scrollTop() is greater than 250.
I have checked the value of scrollTop() to ensure accumulation is not an issue, and have tried various approaches without success. My goal is to eventually smooth out the hover effects with animations, but that's a task for another time.
Any assistance or advice would be greatly appreciated!