Reputation: 110
I am building a single page WordPress theme (index.php including header.php and footer.php)
the navigation inside the site is done by jquery div hiding and showing...
as a result,the url of the page do not change, but i want to make it possible so people can share links of specific sections (or states) and bookmark, and have back-button functionality working. how that can be done?
Upvotes: 1
Views: 201
Reputation: 1378
You are looking for deep linking.
jQuery Address* its a plugin for deep linking, with crossbrowser support.
*Github itself has the functionality you are looking for, check the slide transitions while browsing the source of a project. Although github's deep linking only works with the History API.
Upvotes: 1
Reputation: 19581
You can use hashtags with your links :
HTML :
<a href='#sectionOne'>SectionOne</a>
<a href='#sectionTwo'>SectionTwo</a>
<section id='sectionOne'>Hey there, I'm section One</section>
<section id='sectionTwo'>Hey there, I'm section Two</section>
CSS :
section {
display: none;
}
section:target {
display: block;
}
Clicking on your link will create a url in your browser that ends with #sectionOne
which is convinient for bookmarking. Also when you put :target
selector in CSS that specific #sectionOne
will be visible, according to your CSS :
Demo : http://jsbin.com/ogodeg/1
Upvotes: 0