Good day to all!

I have a question. There is a slider. I want him to call the address of the image in the address bar. When adding

location.hash = url

it adds the full address.

It turns out:

http://example.ru/news/id/1410#http://examle.ru/pictures/o/621/39.jpg

And I want it to be something like:

http://test2.tvc.ru/channel/brand/id/1410#46.jpg

Update

More precisely, the address was changed to the address of the picture, and when it was closed, the original address was returned.

    1 answer 1

    So just add id images:

    window.location.hash = id; // будет site.ru/gallery/#39 

    Just the other day I did a similar exercise (see source).

    • This business does not work. Maybe there is a method to simply display part of the address? And there is no particular desire to use the hashtag) - iviv90
    • one
      Without a hashtag, you can only in modern browsers that support the HTML5 History API . - Sergiks