issues with links containing # character

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Thu Jul 16, 2015 7:42 pm
Reply with quote
Report this post
Dear Support!

I experienced if I put an anchor link or just an outgoing link with # character the link is simply not working.

I think it is because of some kind of script. Could you help me to find out why it is not working?

I have a clear quickstart installed and I made two menu item in the main menu.

Their menu item type is External URL.

They are called:
With #
Without #

please have a look on that.

The URL: http://instyle.demo.cloudhoreca.com/

Thank you in advance,

Oliver
User avatar
Fresh Boarder

GK User
Fri Jul 17, 2015 10:58 am
Reply with quote
Report this post
Hello,

Please go to the template settings and under the Features tab please try to disable the smoothscroll feature.
User avatar
Administrator

GK User
Fri Jul 17, 2015 11:59 pm
Reply with quote
Report this post
Hello dziudek,

Thank you for your answer.

I disabled it and it worked.
Unfortunately I am using this feature (smoothscroll) for my anchor links so I would like to keep enabled it.

If an anchor link (for example #services) is on the same page the smooth scroll and the link is working.

If this link is loaded from an other site (like: /en/what-we-do.html#services) it is simply not working.

Is there any way to disable smoothscroll for an URL like /en/what-we-do.html#services so it could load the link?

Any other solution would be good to me I would like to use the smoothscroll feature and having anchor links working on the site at the same time.

Thank you.
User avatar
Fresh Boarder

GK User
Tue Jul 21, 2015 9:32 am
Reply with quote
Report this post
Now I see that you are using v.3.17 when in v.3.18 we have added some smoothscroll improvements.

Please try to replace the smoothscroll code in js/gk.scripts.js file with the below one:
Code: Select all
if(jQuery(document.body).attr('data-smoothscroll') == '1') {
      // smooth anchor scrolling
      jQuery('a[href*="#"]').on('click', function (e) {
           e.preventDefault();
           if(this.hash !== '') {
               var target = jQuery(this.hash);

               if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {   
                   if(target.length && this.hash !== '#') {
                       jQuery('html, body').stop().animate({
                           'scrollTop': target.offset().top
                       }, 1000, 'swing', function () {
                           if(this.hash !== '#') {
                               window.location.hash = target.selector;
                           }
                       });
                   } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
                       window.location.href = this.href;
                   }
               } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
                   window.location.href = this.href;
               }
           }
       });
   }


and of course please re-enable the feature under the template settings.
User avatar
Administrator

GK User
Wed Jul 22, 2015 1:48 am
Reply with quote
Report this post
Thank you so much!
It's working!
Have a nice day man!
User avatar
Fresh Boarder


cron