Free and Premium WordPress Plugins & Themes Forums WordPress Themes Emmet Add/Remove Class for Sticky Header
- This topic has 1 reply, 2 voices, and was last updated 7 years, 11 months ago by J. Davis.
- AuthorPosts
- January 13, 2017 at 5:16 pm #451199David WashburnGuest
I am using the Sticky Header on our website (http://dayz.rocks). When I scroll up or down the emmet.min.js file adds a class and removes to the TOP-HEADER div. I would like to add/remove a second class when I scroll. I have already figured out how to add the class but I can’t figure out how to remove it when I scroll back up.
` /*
* Stycky menu
*/
if ($(‘.site-header’).attr(‘data-sticky-menu’) === ‘on’) {
var y = $(this).scrollTop();
if (y >= top) {
$(‘.site-header’).addClass(‘fixed’);
$(‘.top-header’).addClass(‘headerfix’); /* I ADDED THIS */
} else {
$(‘.site-header’).removeClass(‘fixed’);
$(‘.top-header’).removeClass(‘headerfix’); /* I ADDED THIS */
}
}
var addTo = 0;
if ($(‘.site-header’).attr(‘data-sticky-menu’) === ‘on’ && $(window).width() > 767) {
if ($(‘.site-header’).hasClass(‘fixed’)) {
addTo = $(‘.site-header’).outerHeight();
} else {
addTo = $(‘.site-header’).outerHeight() + $(‘.site-header’).outerHeight();
}
}Any help getting my class “headerfix” to REMOVE when I scroll back up would be much appreciated!
January 17, 2017 at 3:54 pm #453008J. DavisKeymasterHi David,
We’ll fix the issue with next version of the theme. You can use static menu currently. We’ll do our best to release an update as soon as it is possible.
Best regards,
John - AuthorPosts
- You must be logged in to reply to this topic.