Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery modals and deep linking
    text
    copied!<p>I currently have a gallery which opens a modal pop up when you click on the thumbnail. What I would like to do is to be able to generate a unique link specifically for the modal (i.e.; www.mywebite.com/#link1), which loads it's content via ajax. If somebody was to send this unique modal link and send it to someone and they were to paste it into their browser, ideally I would like the modal window to load and display its content automatically, without the user having to click on the appropriate thumbnail.</p> <p>Is this even possible?? I know this is not the easiest of tasks and any help with this would be greatly appreciated.</p> <p>To get an idea of what I'm working on go to: <a href="http://www.ddbremedy.co.uk/siteupdate/work" rel="nofollow">http://www.ddbremedy.co.uk/siteupdate/work</a></p> <p>You will see an iMac screen with the thumbnails on it.</p> <p>Many thanks in advance.</p> <p>UPDATE!!!!!</p> <p>Ok this is where I am currently at. I have decided to scrap using jquery address and am deep linking using 'window.location.hash' instead.</p> <p>Code is something like this:</p> <pre><code>var base_url = "http://www.ddbremedy.co.uk/siteupdate/"; $('#work_gallery li a').on('click', function(event) { event.preventDefault(); postLink = $(this).attr('href'); window.location.hash = postLink.replace(base_url, ""); /* I have a bunch of code that animates the modal window in which I don't need to include as there is quite alot of it. Content loads via ajax. Then when I close the modal I add this code to remove the hash and revert the link back to its original state. */ if ("pushState" in history) { history.pushState("", document.title, window.location.pathname); } else { window.location.hash = ""; } }); </code></pre> <p>The above code works fine and displays the link exactly as I want it to when I load and close external content with ajax. Now what I need to figure out is how I can automatically load the ajax content if somebody takes that link and pastes it in the address bar. The content is loaded based on the links href and a click event, so how would I trick the browser into thinking that the correct link was clicked and load the correct content, purely based on it's link?</p>
 

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