Support Forums for LiveMesh Themes & Plugins › Forums › Agile Theme Support › Anchor link in navigation prevents page from loading
Tagged: Menu jQuery anchor links
- This topic has 12 replies, 7 voices, and was last updated 10 years, 4 months ago by Nexus.
-
AuthorPosts
-
March 2, 2014 at 2:37 am #4940jrarelyMember
Just trying to replicate the functionality of the sample data where you’ve got a single page with anchor links in the global navigation that correspond to sections down the page (www.mysite.com#services works in firefox, but not in chrome, http://www.mysite.com/#services doesn’t work in either, but at least the full page loads in chrome).
In chrome, yours works, mine throws the following error:
Uncaught Error: Syntax error, unrecognized expression: #services/ jquery.js?ver=1.10.2:3 at.error jquery.js?ver=1.10.2:3 mt jquery.js?ver=1.10.2:3 kt jquery.js?ver=1.10.2:3 at jquery.js?ver=1.10.2:3 x.fn.extend.find jquery.js?ver=1.10.2:4 x.fn.x.init jquery.js?ver=1.10.2:3 e.fn.init jquery-migrate.min.js?ver=1.2.1:2 x jquery.js?ver=1.10.2:3 (anonymous function) main.js?ver=1.0:242 x.extend.each jquery.js?ver=1.10.2:3 x.fn.x.each jquery.js?ver=1.10.2:3 MO_THEME.init_page_navigation main.js?ver=1.0:239 MO_THEME.init_menus main.js?ver=1.0:322 (anonymous function) main.js?ver=1.0:598 c jquery.js?ver=1.10.2:3 p.fireWith jquery.js?ver=1.10.2:3 x.extend.ready jquery.js?ver=1.10.2:3 q jquery.js?ver=1.10.2:3
Tried adding
$('a[href*=#]').smoothScroll();
to main.js with no luck.
Can’t think of anything else that is causing the problem. Help would be appreciated.March 2, 2014 at 9:40 am #4943jrarelyMemberFigured out my first problem. Site now loads, but still having trouble getting anchor links on other pages to work: like in the sample data, clicking the “Team” link from the blog page loads up directly at the “Team” page section on the homepage. In my case, it just scrolls to the top of the current page instead of going to the appropriate anchor. This is only true for the links in the global nav; other links within the page navigate as expected.
March 2, 2014 at 6:10 pm #4947jrarelyMemberUpon further investigation, it doesn’t work with the installed sample data either, just on your site at https://www.livemeshthemes.com/agile/
So…what file(s) did you forget to include in the theme? Why will the anchor links like https://www.livemeshthemes.com/agile/#services in the global nav work as expected when clicked from another page in the site on your server, but not on mine, even with the sample data and all plug-ins correctly installed and nothing else changed?
Thanks!
March 3, 2014 at 5:55 am #4956haochuanluMemberhi, my sebsite is http://en.sindrax.com/, and I have the same problem with you, which is I could not click the Anchor If I was not in the homepage.
March 3, 2014 at 6:04 am #4958RaghavendraModeratorA fix is coming in an update to be submitted in next few hours. More details will follow. Thanks
March 3, 2014 at 6:15 am #4960RaghavendraModeratorPls modify the js/main.js file at line number 212 to look for the single page template in the condition.
So, the line
if ($().smoothScroll !== undefined) { $('#primary-menu > ul > li > a[href*=#]').smoothScroll(
changed to
if ($().smoothScroll !== undefined) { $(‘.single-page-template #primary-menu > ul > li > a[href*=#]').smoothScroll(
so that smooth scroll does not get activated for pages which are not using single page site template. You can change the flag preventDefault in line number 214 to false instead of true but while solving the current problem, introduces a new “problem” where the div id suffixes get appended to the url in the address bar. Only problem with that – it changes the Back button flow.
As said earlier, this fix will be part of upcoming update. The issue does not seem to affect the demo site.
March 3, 2014 at 3:35 pm #4984jrarelyMemberThanks! I actually found another work-around while I was waiting by creating another custom menu for the non-single page format pages; but I’ll check this out as well.
March 4, 2014 at 3:13 pm #4994RaghavendraModeratorGreat. Just want to mention, this is part of the latest update available for download.
March 15, 2014 at 6:33 pm #5210egoexmachinaMemberTwo things:
1. I have the same problem. The anchors work great when I am in the main page. But once I am in a separate page, they don´t work at all. No response to the menu items with anchors if I click the menu in a different page. (curiosly enough, if I click the menu item, nothing happens. but if I right-button “open in a new tab”, it kind of works. doesn´t go to the right anchor, but at least it loads the correct page.
Also, tried to fix the main.js as you suggested before. The menu works fine then, but the contents of the site don´t work at all. They just appear blank except for header and footer. In all pages of the site.
I have my anchors in the menu written as “http://mysite.com/#pricing”. If I change them to “http://www.mysite.com/#pricing”, they work ok from different pages, but when I am in the main page, they reload the page and then go to the anchor. So no solution there.2. You mention an update available for download. Where is it? Where can I get it
March 17, 2014 at 10:58 am #5222egoexmachinaMemberThis reply has been marked as private.March 18, 2014 at 4:48 am #5256ErnestoMemberHi,
Go to the Downloads Section of yout Theme Forest Account and there you can download the latest version of the Theme.
May 28, 2014 at 2:01 pm #7056kagamushuMemberThis reply has been marked as private.May 30, 2014 at 11:08 am #7105NexusModeratorI have replied to you in the dashboard. Pls check.
-
AuthorPosts
- The forum ‘Agile Theme Support’ is closed to new topics and replies.