Code: Select all
Journal.enableStickyHeader = function (padding) {
var header = $('.header');
Journal.stickyHeaderHeight = $('header').outerHeight();
var lastScroll = 0;
$('.header-notice').each(function() {
Journal.stickyHeaderHeight += $(this).outerHeight();
});
header.css('top', '-' + (Journal.stickyHeaderHeight) + 'px');
$(window).scroll(function() {
var currentScrollPosition = $(window).scrollTop();
if ($(window).scrollTop() > 1 * (Journal.stickyHeaderHeight) ) {
$('body').addClass('is-sticky').css('padding-top', Journal.stickyHeaderHeight + padding);
header.css('top', 0);
if (currentScrollPosition < lastScroll) {
header.css('top', '-' + (Journal.stickyHeaderHeight) + 'px');
$('.tablet .is-sticky .mega-menu').hide();
}
if(Journal.hasStickyScroll) {
lastScroll = currentScrollPosition;
}
} else {
$('body').removeClass('is-sticky').css('padding-top', padding);
}
});
};
I already change $('header') with $('#search') but still not working. Anybody here have same problem before? I'm using Journal 2 Theme and Opencart 1.5.6.4 and Journal 5 template