0

ここにアプリケーションがあり、約20秒間何もしないと、続行するかログオフするかを示すアイドルタイムアウトプラグインメッセージが表示されます。

問題は、コーナーの一番上のボタンにaxボタンが表示され、ユーザーがxボタンをクリックするとメッセージが表示されますが、タブではタイマーが継続することです。

では、私の質問は、メッセージの上隅にあるxボタンをどのように削除できるかということです。

以下は、アプリケーションのコードです。

<head>
<script type="text/javascript">

$(document).ready(function()

{

    $("#dialog").dialog({
    autoOpen: false,
    modal: true,
    width: 400,
    height: 200,
    closeOnEscape: false,
    draggable: false,
    resizable: false,
    buttons: {
        'Yes, Keep Working': function(){
            // Just close the dialog. We pass a reference to this
            // button during the init of the script, so it'll automatically
            // resume once clicked
            $(this).dialog('close');
        },
        'No, Logoff': function(){
            // fire whatever the configured onTimeout callback is.
            $.idleTimeout.options.onTimeout.call(this);
        }
    }
});


$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
    idleAfter: 5, // user is considered idle after 5 minutes of no movement
    pollingInterval: 60, // a request to keepalive.php (below) will be sent to the server every minute
    onTimeout: function(){

        // redirect the user when they timeout.
        window.location = "timeout.htm";

    },
    onIdle: function(){

        // show the dialog when the user idles
        $(this).dialog("open");

    },
    onCountdown: function(counter){

        // update the counter span inside the dialog during each second of the countdown
        $("#dialog-countdown").html(counter);

    },
    onResume: function(){

        // the dialog is closed by a button in the dialog
        // no need to do anything else

    }
});

});


</script>

</head>

<body>

<div id="dialog" title="Your session is about to expire!">
    <p>You will be logged off in <span id="dialog-countdown"></span> seconds.</p>
    <p>Do you want to continue your session?</p>
</div>
</body>
</html>
4

2 に答える 2

1

Yoouは、ダイアログを開くときにXを非表示にすることができます。

$("#div2").dialog({
   closeOnEscape: false,
   open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
}); 

これが元のSOの質問と回答です

于 2012-06-04T00:14:31.467 に答える
0

または単に置く

<style>
     .ui-dialog-titlebar-close { display: none ; }
</style>
于 2014-01-31T13:54:58.983 に答える