Making menu nav sticky

lukcda
Offline
Last seen: 1 year 11 months ago
Mon, 07/06/2015 - 14:17
#1
Making menu nav sticky

Hi I need assistance with making the menu nav sticky as soon as the user scrolls. Thanks

cindy
cindy's picture
Offline
Last seen: 7 hours 28 min ago
Tue, 07/07/2015 - 10:59

Hi,
Please open file scripts.js
and replace the following code:
$(window).on('scroll', function() {
//header fixed
var windownScrolltop = $(window).scrollTop();
if (windownScrolltop > 180) {
$('.header-sticky')
.addClass('header-fixed');
$('.sticky-fix').height(headerHeight);
} else {
$('.header-sticky')
.removeClass('header-fixed');
$('.sticky-fix').height(0);
}
});

with

$(window).on('scroll', function() {
//header fixed
var windownScrolltop = $(window).scrollTop();
if (windownScrolltop >= 0) {
$('.header-sticky')
.addClass('header-fixed');
$('.sticky-fix').height(headerHeight);
} else {
$('.header-sticky')
.removeClass('header-fixed');
$('.sticky-fix').height(0);
}
}).trigger('scroll');

If you want header sticky, just add class header-sticky in file html:
Example: <header id="header" class="header header-2 header-sticky">

lukcda
Offline
Last seen: 1 year 11 months ago
Fri, 07/17/2015 - 15:16

Hi, I just want to double check, is this for the actual product menu? I want the menu that contains the breakfast, lunch, dinner items to stick underneath to stick as they scroll, because there are many items? Sorry I should have been more specific :)

cindy
cindy's picture
Offline
Last seen: 7 hours 28 min ago
Mon, 07/20/2015 - 10:49

Hi,
Please send us your file script.js to cindy@megadrupal.com (also this forum link)
We will edit your file for you

Log in or register to post comments