2012-06-03 27 views
0

我有一個應用程序here如果您在20秒內沒有做任何事情,它會顯示一個空閒超時插件消息,指出是否要繼續或註銷。如何從jquery插件中刪除x按鈕

問題是它在角落的頂部按鈕上顯示一個x按鈕,並且如果用戶單擊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> 
+0

「語法錯誤在jquery.idletimeout.js 1號線」,這表明你正在使用JavaScript的最小化版本,調試最小化JavaScript是隻是在挫折中鍛鍊。如果使用非最小化版本,會發生什麼情況? –

+0

@ muistooshort最小化和非最小化版本意味着什麼? – user1394925

+0

[jquery.idletimeout.js'的第1行](https://github.com/ehynds/jquery-idle-timeout/blob/master/src/jquery.idletimeout.js#L1)是一條評論,我懷疑語法錯誤在那裏。最小化JavaScript會刪除註釋和空白以減小文件大小,結果通常只有一行JavaScript。 –

回答

0

或者乾脆把

<style> 
    .ui-dialog-titlebar-close { display: none ; } 
</style>