$(window).scroll(function() {
const $banner = $('.banner');
const bannerHeight = $banner.outerHeight(true);
const bannerTop = parseInt($banner.css('top'), 10);
const windowTop = $(this).scrollTop();
$banner.toggleClass('hide', $('.fullwidth').get().some(n => {
const $n = $(n);
const nTop = $n.offset().top - bannerTop;
const minTop = nTop - bannerHeight;
const maxTop = nTop + $n.outerHeight(true);
return windowTop > minTop && windowTop < maxTop;
}));
});