Peesen87 Peesen87 - 6 months ago 47
Javascript Question

Photoswipe / Use Close Button as History Back Button

I am not a good Javascript Programmer and so im coming to this question. I am using Photoswipe for some galleries in a project. Some galleries i dont use the thumbnail preview im opening them directly. Now, when i click the close button the image disappears and you can see just a blank page.
Now i want to use the close button as a back in history function. I am using jquery and the photoswipe plugin, no jquery mobile or sansa touch.

Thanks for your help
Michael

Answer

add the following to the button:

onclick="history.go(-1)

Now your button will look something like

<a href="#" onclick="history.go(-1)">Close</a>