Open same popup dialog on multiple pages Jquery Mobile 1.4.5

1.3k views Asked by At

In my app I have a popup that will come up on any page within the app to log a user out if they stay inactive for too long. I had this working in JQM 1.4.2 but now I have upgraded to 1.4.5 the popup will not appear on any page that has not had a page refresh.

I was initially calling all popups using #id so I thought changing it to use a class would solve the problem but it didn't.

Code: (simplified to show a basic popup on each page)

popup page included in all files:

<div data-role='popup' class='class_popCountDown' data-theme='a'
data-overlay-theme='a' data-dismissible='false'
style='min-width: 300px;'>
<div data-role='header' data-theme='a'>
    <h1>Time Out</h1>
</div>
<div data-role='main' class='ui-content'>
    <p>
        this is a popup test    
    </p>
    <a href="#" class="ui-btn" data-rel="back">cancel</a>
</div>

<script>
function displayPopupTest() {
        $(".class_popCountDown").popup("open");

};
</script>

For this example I'm just trying to open the popup using this on each page:

<a href="#" onclick="displayPopupTest();" >open popup</a>

So... Page 1 - click link popup opens - change page - page 2 (onwards) - click link popup does not open but can see the code executing in the console.

Any ideas on how to fix this? Thanks

1

There are 1 answers

1
AishwaryaVengadesan On

May be this issue missed out data-rel ,

<a data-rel="popup" href="#id" onclick="displayPopupTest();" >open popup</a>