Multi-Currency Pricing in Gridbox Store App

Multi-Currency Pricing in Gridbox Store App
Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Single Page Menu

3 years 6 months ago #1

  • Greedbegone's Avatar
  • Greedbegone
  • Posts: 711
Is there a way to add a menu item to a one page menu that links to a different page rather than an end point on the same page?

Best,
Matt

3 years 6 months ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 24047
Hello,
Thank you for contacting us

The answer to your question in this post
support.balbooa.com/forum/gridbox/5642-e...ge-menu-plugin#25950

Regards,
Vyacheslav, Balbooa.com

3 years 6 months ago #3

  • Greedbegone's Avatar
  • Greedbegone
  • Posts: 711
Hello,

I created a menu and added anchors to the page, however the JavaScript for smooth scrolling doesn't seem to be working on the front end
var someAnchor = window.location.hash;
jQuery(document).on('ready', function(){
 if (someAnchor) {
  var top = jQuery(someAnchor).offset().top;
  top -= jQuery('header').height();
  jQuery("html, body").animate({
   scrollTop: top
  }, 1);
 }
});

webbysource.com

3 years 6 months ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 24047
Hello,

Use this code instead of what we sent you earlier.
(function($){
    $(document).ready(function(){
        var $menu = $(".main-menu"),
            checked = false;
        $(window).scroll(function(){
            if ( $(this).scrollTop() > 100 && $menu.hasClass("menu-hidden") ){
                $menu.removeClass("menu-hidden");
            } else if($(this).scrollTop() <= 100 ) {
                $menu.addClass("menu-hidden");
            }
        });
        $('.main-menu a[href*="#"]').on('click', function(event){
            event.preventDefault();
            var target = $(this.hash),
                $this = this;
            if (target.length) {
                checked = false;
                $('.main-menu a[href*="#"]').removeClass('active');
                $('.main-menu a[href="'+this.hash+'"]').addClass('active');
                $('html, body').animate({
                    scrollTop: target.offset().top - 150
                }, 500, function(){
                    checked = true;
                    var loc = location.href.replace(location.hash, '');
                    window.history.pushState(null, null, loc+$this.hash);
                });
                return false;
            }
        });
        var hashCoord = {},
            item = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html');;
        $('.main-menu a[href*="#"]').each(function(){
            var target = $(this.hash);
            if (target.length) {
                hashCoord[this.hash] = target.offset().top - 150;
            }
        });

        $(window).on('scroll', function(){
            if (!checked) {
                return false;
            }
            var top = $(window).scrollTop(),
                flag = '';
            for (key in hashCoord) {
                if (top >= $(key).offset().top - 150) {
                    flag = key;
                }
            }
            if (location.hash != flag) {
                var loc = location.href.replace(location.hash, '');
                $('.main-menu a[href*="#"]').removeClass('active');
                $('.main-menu a[href="'+flag+'"]').addClass('active');
                window.history.pushState(null, null, loc+flag);
            }
        });
        $(window).on('load', function(event){
            $('.main-menu a[href*="#"]').removeClass('active');
            $('.main-menu a[href="'+location.hash+'"]').addClass('active');
            checked = true;
            if ($(window).scrollTop() > 100 && $menu.hasClass("menu-hidden") ){
                $menu.removeClass("menu-hidden");
            } else if($(this).scrollTop() <= 100 ) {
                $menu.addClass("menu-hidden");
            }
        });
    });
})(jQuery);

Regards,
Vyacheslav, Balbooa.com
Powered by Kunena Forum