monkeyWzr / hugo-theme-cactus

Cactus theme for hugo
MIT License
537 stars 338 forks source link

menu items dissapear #119

Open codetoadsnow opened 2 years ago

codetoadsnow commented 2 years ago

Is it possible to fix the all menu at the top? At now all items dissapear when i scroll down.

image

RobbiNespu commented 2 years ago

It actually a features for better UX. Anyway, go to js/main.js and put comment or remove the portion you don't want

Secd0g commented 2 years ago

If you want it to be displayed all the time, you can delete a piece of code in main.js:

if (menu.length) {
      $(window).on("scroll", function() {
        var topDistance = menu.offset().top;

        // hide only the navigation links on desktop
        if (!nav.is(":visible") && topDistance < 50) {
          nav.show();
        } else if (nav.is(":visible") && topDistance > 100) {
          nav.hide();
        }

        // on tablet, hide the navigation icon as well and show a "scroll to top
        // icon" instead
        if ( ! $( "#menu-icon" ).is(":visible") && topDistance < 50 ) {
          $("#menu-icon-tablet").show();
          $("#top-icon-tablet").hide();
        } else if (! $( "#menu-icon" ).is(":visible") && topDistance > 100) {
          $("#menu-icon-tablet").hide();
          $("#top-icon-tablet").show();
        }
      });
    }
indeedwatson commented 1 year ago

If you want it to be displayed all the time, you can delete a piece of code in main.js:

if (menu.length) {
      $(window).on("scroll", function() {
        var topDistance = menu.offset().top;

        // hide only the navigation links on desktop
        if (!nav.is(":visible") && topDistance < 50) {
          nav.show();
        } else if (nav.is(":visible") && topDistance > 100) {
          nav.hide();
        }

        // on tablet, hide the navigation icon as well and show a "scroll to top
        // icon" instead
        if ( ! $( "#menu-icon" ).is(":visible") && topDistance < 50 ) {
          $("#menu-icon-tablet").show();
          $("#top-icon-tablet").hide();
        } else if (! $( "#menu-icon" ).is(":visible") && topDistance > 100) {
          $("#menu-icon-tablet").hide();
          $("#top-icon-tablet").show();
        }
      });
    }

I commented this out and the menu just won't appear at all.