Close div / popup when clicking back button

0

Jquery Mobile provides popups that are closed when the user presses the 'back' button and wanted to implement this 'function' in my web app. Here's a fiddle with an example: link

But I wanted this code to be cleaner, because the script creates divs on the page, adds classes to the body, the popup needs multiple parent elements. This ends up bugging my already established style and not allowing a detailed styling. What's more, I do not use popup, I use a common div for these "windows" (it's more appropriate in my case).

I notice that when clicked to open, the script creates a #link in front of the url, eg:

link

and pressing 'back', #link disappears and the popup closes.

My question is: is there a way to do this manually ?

Note: these my "windows" are placed as follows:

<div id="janela" style="display:none">conteúdo</div>
<div id="abrirjanela">abrir</div>

$("#abrirjanela").click(function(){
    $("#janela").show();
});
    
asked by anonymous 04.12.2018 / 21:09

0 answers