У меня есть приложение here, где, если вы ничего не сделаете в течение примерно 20 секунд, на нем будет отображаться сообщение с плавным отключением таймаута, указывающее, хотите ли вы продолжить или выйти из системы.Как удалить кнопку x из jQuery-плагина
Проблема заключается в том, что она отображает кнопку 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>
"ошибка синтаксиса линии 1 в jquery.idletimeout.js" предполагает, что вы используете свернутые версии JavaScript, отладки минимизированы JavaScript является немного больше, чем упражнение в расстройстве. Что произойдет, если вы используете не минимизированные версии? –
@muistooshort Что означают минимальные и не минимизированные версии? – user1394925
[Строка 1 из 'jquery.idletimeout.js'] (https://github.com/ehynds/jquery-idle-timeout/blob/master/src/jquery.idletimeout.js#L1) является комментарием, я сомневаюсь синтаксическая ошибка есть. Минимизация JavaScript удаляет комментарии и пробелы, чтобы уменьшить размер файла, результатом, как правило, является одна длинная строка JavaScript. –