A modal window with an image that pops up by clicking on a preview and having its own unique link is required (if the user clicks on it, the same page opens with the modal window already loaded). This is how the view of VKontakte images is implemented.

Maybe there is somewhere ready libraries that give this functionality?

Or it’s not necessarily the images, at least just a library for creating modal windows that can be opened from the links.

Thanks a lot in advance!

    3 answers 3

    Try after the output window with the image dynamically JavaScript'om change the URL. Here is an example of using pushState and replaceState:

    // эмуляция перехода на страничку "/page2.html" без перезагрузки странички window.history.pushState("object or string", "Title", "/page2.html"); // замена текущего URL на "/page3.html" window.history.replaceState("object or string", "Title", "/page3.html"); 

    More here

      fancybox very advise, wonderful thing. In general, such plug-ins the sea, for every taste.

      • You probably did not read the question well. Pictures open, great, but (!) URL remains unchanged. - andrewshka

      a hash is added to remodal at the end of the url, a link with the necessary hash tag will open a modal window