简体   繁体   English

如何制作类似警报的警报/确认对话框

[英]How to make alert-like synchronized alert/confirm dialog

I am building a confirmation dialog to remind user that the current token is getting expired very soon, once the they hit "confirm" then I will make an post call to refresh the token, if they don't hit confirm, then the token will not be refreshed. 我正在建立一个确认对话框,以提醒用户当前令牌即将过期,一旦他们点击“确认”,我将进行邮寄以刷新令牌,如果他们没有点击确认,那么令牌将不刷新。

I used alert / confirm dialog by default in JS now. 我现在在JS中默认使用alert / confirm对话框。 However, I found the alert / confirm dialog is for entire browser which is a little bit annoying, I am looking for a way to show dialog for the application tab only. 但是,我发现alert / confirm对话框适用于整个浏览器,这有点烦人,我正在寻找一种仅显示应用程序选项卡对话框的方法。 Meaning, default alert function in JS actually shows the dialog regardless the tab you are at now. 意思是,无论您当前处于哪个标签页,JS中的默认警报功能实际上都会显示该对话框。

Can anyone tell me the basic idea how to implement this? 谁能告诉我该实施的基本思路?

I would look into the .dialog() method in jQuery. 我将研究jQuery中的.dialog()方法。 You can create buttons for that dialog and have the buttons do what you want without blocking the entire browser. 您可以为该对话框创建按钮,并让这些按钮执行您想要的操作而不会阻塞整个浏览器。 https://jqueryui.com/dialog/ https://jqueryui.com/dialog/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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