Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Linking Folders to Anchors links - ISSUE


Roxyjee
Go to solution Solved by tuanphan,

Question

Site URL: https://www.susanchalkermassage.com/

Hi Guys,

I have added code in my header to link my folders in my navigation to an anchor on my homepage as I have created a one pager. Only the blog ,contact form and from Lomi Lomi in the dropdown of massages all goes to its own page.

 The issue I am having is ....It works at first as you will see when you go to the site https://www.susanchalkermassage.com/ but as soon as I Click the Logo to go to homepage and try and click on the Header links (Say I go to the About page, it says "This folder does not contain any pages.").  Its also not linking on mobile at all.

Did I add something wrong in my code or am I missing something.

 

<script type="text/javascript" src="jquery-1.11.1.min.js"></script>

<!-- Redirecting Testimonial on nav -->
  <script>
Y.on('domready', function(){
Y.one('nav a[href="/testimonial"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#testimonial-home';
});
});
</script>
<!-- Redirecting About on nav -->
 <script>
Y.on('domready', function(){
Y.one('nav a[href="/about"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#susan';
});
});
</script>

<!-- Redirecting Individualized Massage on nav -->
  <script>
Y.on('domready', function(){
Y.one('nav a[href="/individualized"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#individualized-massage';
});
});
</script>

<!-- Redirecting Location on nav -->
  <script>
Y.on('domready', function(){
Y.one('nav a[href="/location"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#location-address';
});
});
</script>

<!-- Redirecting Massages on nav-->
  <script>
Y.on('domready', function(){
Y.one('nav a[href="/rates"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#massage-rates';
});
});
</script>

<!-- Redirecting massages page -->
  <script>
Y.on('domready', function(){
Y.one('nav a[href="/massages"]').on('click', function(e){
  e.preventDefault();
  e.stopPropagation();
  window.location = 'https://www.susanchalkermassage.com/#massage-modalities';
});
});
</script>




<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>   
<script>
 function anchorLinks(){


      Y.all("a.Mobile-overlay-nav-item").on('click', function() {
         Y.one('body').removeClass('is-mobile-overlay-active');
      });
      Y.all("a.Mobile-overlay-folder-item").on('click', function() {
      Y.one('body').removeClass('is-mobile-overlay-active');
   });



  if(!Y.one('.collection-type-index')){

      Y.all(".Mobile-overlay-nav--primary .Mobile-overlay-nav-item:not(.Mobile-overlay-nav-item--folder')").each(function(){
      this.on("click", function(){
         var newURL = "http://"+window.location.host +(this.getAttribute('href'));
         window.location.href = newURL;
       });
    });

  }
}


function scrollToURLAnchor(){
 setTimeout(function(){
   if(window.location.hash){

     $('html, body').animate({
         scrollTop: $(window.location.hash).offset().top
     }, 600,  function () {

     });
   }
   }, 700);


}

Y.on('domready', function(){
  anchorLinks();
  scrollToURLAnchor();

  if(window.location.hash != ''){
    $('a[href*="#"].Mobile-overlay-nav-item').on('click', function(){
      var newURL = 'http://'+window.location.host +$(this).attr('href');
      window.location = newURL;
    });
  }

});

window.addEventListener('mercury:load', anchorLinks);
window.addEventListener('mercury:load', scrollToURLAnchor);

</script>

 

Edited by Roxyjee
Link to post
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Popular Posts

Disable Ajax Loading: https://support.squarespace.com/hc/en-us/articles/115000253288-Ajax-loading

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 4/2/2020 at 11:59 AM, tuanphan said:

Oh my WORD! Thanks so much @tuanphan I completely forgot to disable ajax, its working now. Just a question why wouldn't my mobile menu work though? It's now not linking to where it should it's showing as a folder and then clicking in the folder. Do I have to add css?

Edited by Roxyjee
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...