Post by bojongkenyod » Tue Feb 13, 2018 9:12 pm

I want to create a sticky header for the search, not the menu. Can someone tell me where should I change the code? I have found journal.js and jquery.sticky.js. Here's the clip code for journal.js about sticky menu:

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);
    }
});
};
Sticky JS is used from here : http://stickyjs.com

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

Newbie

Posts

Joined
Thu Apr 25, 2013 1:56 pm

Post by straightlight » Wed Feb 14, 2018 7:00 am

Contact the Journal support team for any Journal inquiries.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Guru Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Baidu [Spider] and 45 guests