My code works perfectly on Firefox, but I'm having issues with my "calc" variable in Chrome and Safari. You can view the problem here:
Any assistance would be greatly appreciated!
var hidetop = $("#hidetop");
var range = $("#hidetop").height();
var body = $("#wrappercover");
$(document).on('scroll', function() {
var scrollTop = $(this).scrollTop();
var offset = hidetop.offset().top;
var height = hidetop.outerHeight();
offset = offset + height;
var calcA = 1 - (scrollTop - offset + range) / range;
hidetop.css({
'opacity': calcA
});
if (calcA > 1) {
hidetop.css({
'opacity': 1
});
} else if (calcA < 0) {
hidetop.css({
'opacity': 0
});
}
});