Note that there are some explanatory texts on larger screens.

plurals
  1. POsaving and loading the ajax state of a page
    primarykey
    data
    text
    <p>I'm working on an ajax loading function on a Wordpress single page portfolio.</p> <p>The principle is that when you click a thumbnail in the gallery, it opens a container (#DrawerContainer) and fetch the ajax content of this article into it. With a lot of help, I'm already able to open the drawer and load the post content when I click a thumbnail.</p> <p>Here is a fiddle if you want to see it working (the ajax will not load but it works locally). <a href="http://jsfiddle.net/RF6df/24/" rel="nofollow">http://jsfiddle.net/RF6df/24/</a></p> <p><strong>The part I'm working on now:</strong> I need my site to be crawlable and the urls to be shareable. If I give <code>http://mywebsite.com/#!project5</code> to someone, I need project5 content to be opened when he loads the page.<br/> I thought the hash-bang (#!) urls was the way to go to make this work. With the code below (commented on the jsfiddle), I can update the url and add the hash of the clicked thumbnail.</p> <pre><code>var pathname = $(this).find('a')[0].href.split('/'), l = pathname.length; pathname = pathname[l-1] || pathname[l-2]; window.location.hash = "#!" + pathname; </code></pre> <p>But when I load a page, the ajax state isn't remembered. I assumed it was because my ajax container was only loaded on click event, but there is no change when I add a persistant container in the php.</p> <p>Is there a way to load the page with a post content already displayed, or to open the #DrawerContainer when the page is loading a hash-bang url?</p> <p>Please keep in mind that I'm just learning jquery and ajax. So I'd really appreciate if you explain or comment a little bit what you do, I'll for sure learn at the same time... :) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload