简体   繁体   中英

Open same popup dialog on multiple pages Jquery Mobile 1.4.5

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

可能是这个问题错过了数据相关性,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM