Question

I created a demo for you, here it is. As you can see there is a main image with a related caption and other small images below. If you click one of them the main image/caption changes to display the one you selected. If you notice when you hover the pointer on any of the images below the big one you get a link like test.php/#image3 or test.php/#image6.

I'm looking for a way to have that if you visit test.php/#image3 (directly, not through the onClick event) you have the #image3 as main image (so without having to click on it). The same for test.php/#image4 / #image5, etc.

Was it helpful?

Solution

You can use this:

$url  =  window.location.hash; 

this gives you the #imagex part of the url

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top