Riddler Posted June 23, 2010 Share Posted June 23, 2010 Hi there! I've been searching for days across loads of forums to try and find an answer to this. I've read some posts that seem to get near a solution but they aren't quite what I need. I have installed a neat little piece of code on my site called codaslider http://www.ndoherty.biz/tag/coda-slider/. I originally had problems with navigating around the tabs as every link sent the page back to the root; instead of mysite.com/page.php?thispage_id=42#anchor2 it would navigate to mysite.com/#anchor2 I got around this by adding +location.href+ into the link i.e; ul.append('<li class="tab' + (n+1) + '"><a href="'+location.href+'#' + (n+1) + '">' + $(this).find(settings.panelTitleSelector).text() + '</a></li>'); Navigation works and the tabs move about now BUT it adds a new page to the browser's history every time a new #anchor is clicked. I would like the #anchors to be clickable without adding another page to the browser's history. Is this possible? All help is greatly appreciated! Tim. Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/ Share on other sites More sharing options...
trq Posted June 23, 2010 Share Posted June 23, 2010 Have you looked at the documentation? Ive never used this piece of Js yet was able to track down what you are looking for in less than 30 seconds. Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/#findComment-1076053 Share on other sites More sharing options...
Riddler Posted June 23, 2010 Author Share Posted June 23, 2010 I've read some info at http://www.w3schools.com/jquery/jquery_ref_html.asp and suspect I need to change something to do with ul.append but just cannot get the code to work as I want! I'm guessing it took you 30 seconds because you knew what to look for, I've got very little idea what I'm doing. Allow me to reiterate; help is greatly appreciated. Tim. Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/#findComment-1076086 Share on other sites More sharing options...
trq Posted June 23, 2010 Share Posted June 23, 2010 I meant the documentation for the plugin itself, not jQuery (not that w3schools is much of a reference for anything). See http://www.ndoherty.biz/forums/viewtopic.php?f=4&t=2, the crossLinking option in particular. You need to turn it off. Not sure how to set options? Something like.... $('#yourdiv').codaSlider({crossLinking: false}); Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/#findComment-1076088 Share on other sites More sharing options...
Riddler Posted June 23, 2010 Author Share Posted June 23, 2010 Unbelievable. After days (the total of which must be some ridiculous number of hours) it turns out the solution was under my nose. I'm still not entirely sure how setting crossLinking:false works to prevent a history trail being created every time you click a tab. For the purposes of future reference I'd like to know this works, so I'll forage around the code a little, but for the moment I'm very happy! Thank-you thorpe for the pointer, I really appreciate your efforts to point out this ultra simple (as it turns out) fix! Cheers, Tim. Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/#findComment-1076113 Share on other sites More sharing options...
haku Posted June 23, 2010 Share Posted June 23, 2010 I haven't looked at the code, but it probably adds the hash to allow for deeplinking (i.e. bookmarking a specific selection in the slider) which can also be good for SEO. It's probably on for default, but they appear to give you an option to turn it off. Quote Link to comment https://forums.phpfreaks.com/topic/205630-appending-a-dynamic-url-with-anchor-without-adding-pages-to-history/#findComment-1076184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.