How to link to pages and navigate between them without reloading them?
I’m developing a site heavily based on jQuery and involving WordPress. Is there any way to navigate between pages without reloading the whole thing, other than simple hide/show functions? Or with hide/show how can I link to a certain part of the site?
For example if the home page is a heap of divs
<div id="1">
<p>content here</p>
</div>
<div id="2">
<p>more content here</p>
</div>
By default div 1 is shown and 2 hidden, but how could I load up the page with div 2 showing for example if someone wan开发者_开发百科ts to bookmark it?
I could have a copy of the markup as a separate file with the onload hide/show different for each one, and use the same coding file for functionality.
Would this work, and any tips?
Would it be better to build just a regular site?
Im not quite sure I fully understand you question, but JQuery does make it easy to use Ajax to load content from your server asynchronously. You can find documentation here.
I am not aware of any way to bookmark the state of an HTML document after it has been dynamically modified by JavaScript (except for something called session state that is lost when the window is closed), but there are ways to do bookmarking when you use Ajax.
I have never tried to bookmark with Ajax, and I am pretty sure that JQuery doesn't have this functionality built in.
I don't have never tried bookmarking with Ajax myself, but I found this article which looks very promising.
My opinion is that if the content is significant enough to merit being bookmarked, it probably needs to be built the regular way.
精彩评论