views:

305

answers:

1

I'm creating a slideshow effect using hidden div's. Once a thumbnail is clicked, the corresponding div appears in a window and the other divs are hidden. However, I also need the page to reload. I attempted to use something like this:

$("a").click(function() {
    location.reload();
});

However, this will reload the page without following the link (something like a href="#div02"). How do I get it to both follow the link and reload the page?

A: 

Hi,

If I understand you correctly, what you want is to modify the URL of the browser to reflect the current state of the DOM. Meaning, if a user clicked on a picture, the URL would be updated by appending a "#div02" and finally the user would be able to share this link with friends which will take them directly to that picture/state.

If that's what you want, your looking for Location Hash. To set:

window.location.hash = "#div02";

To get:

window.location.hash
ANaimi
hmm, I'm not sure this is what I was looking for. I'll try to re-explain it:I'm setting up a video page. I've got a main window with overflow: hidden which shows the current movie and has the others hidden from view. To the right are thumbnails to jump to other videos (which bring them into view). However, to get the previous video to stop playing, I would ideally follow the jump link and reload the page. The problem is that it doesn't follow the link and simply refreshes the page.
criley
If that still didn't make sense, let me know and I'll set up a demo page.
criley