【问题标题】:How to display a message before auto refresh div using jquery如何在使用jquery自动刷新div之前显示一条消息
【发布时间】:2015-11-12 11:21:29
【问题描述】:

我试图在自动刷新 div 之前显示一条消息。我已经为自动刷新创建了这个代码。

$(document).ready(function()
{
 if setInterval(function() {
   $("#pagere").load(location.href + " #pagere");}, 10000);             
 });

我还需要显示类似"page auto refresh in 3 sec..." 的消息。我该怎么做?

【问题讨论】:

  • 我在一个拍卖网站工作...随时出价,因此用户必须知道刷新将在 3 秒内发生,就像 tat 一样,因此不会发出警报消息将显示任何其他弹出窗口 :)

标签: php jquery html css


【解决方案1】:
setTimeout(function() {
   $('#load_status').show();
}, 5000);
$("#pagere").load(location.href + " #pagere");}, 10000);

-这将使您在刷新前有 5 秒的超时时间

【讨论】:

  • 谢谢....setTimeout(function() { $('#load_status').show();}, 5000);它实际上是如何工作的。我的查询如何显示它
【解决方案2】:
<script>
    setInterval(function()
    {
        $("#pagere_container").load(location.href + " #pagere");
    }, 3000);
</script>

<div id="pagere_container">
    <div id="pagere">
        page auto refresh in 3 sec...
    </div>
</div>

【讨论】:

    【解决方案3】:

    试试这个:)

    $(document).ready(function()
        {
          var alertTimeSec = 3000; //alert time in ms
          var delayTimeSec = 10000; //time delay to refresh in ms
                setTimeout(function () {
                   alert("3 Sec more")
                }, (delayTimeSec-alertTimeSec));
                setInterval(function() {
                $("#pagere").load(location.href + " #pagere");}, delayTimeSec);    
        });
    

    【讨论】:

    • 是的,您可以使用一种烤面包机或定制设计的滑块来代替警报。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-18
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 2013-11-07
    • 2011-03-06
    相关资源
    最近更新 更多