Add/Remove Class for Sticky Header

  • This topic has 1 reply, 2 voices, and was last updated 6 years ago by J. Davis.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #451199
    David Washburn
    Guest

    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!

    #453008
    J. Davis
    Keymaster

    Hi 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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.