简体   繁体   English

当使用 F5 重新加载 web jQuery 进度条不起作用,我的 web 也没有显示任何内容

[英]When using F5 reload web jQuery progress bar didn't work and my web didn't show any content either

I'm try to add a web loading bar with jQuery on the top of my web, and it's work when I first open this web. I'm try to add a web loading bar with jQuery on the top of my web, and it's work when I first open this web. But when I press F5 reload web, progress bar won't work and my web didn't show any content either(only show a white background web).但是当我按 F5 重新加载 web 时,进度条不起作用,我的 web 也没有显示任何内容(只显示白色背景网页)。 Here is my code:这是我的代码:

    document.onreadystatechange = function (e) {
        if (document.readyState == "interactive") {
            var all = document.getElementsByTagName("*");
            for (var i = 0, max = all.length; i < max; i++) {
                set_ele(all[i]);
            }
        }
    }

    function check_element(ele) {
        var all = document.getElementsByTagName("*");
        var totalele = all.length;
        var per_inc = 100 / all.length;

        if ($(ele).on()) {
            var prog_width = per_inc + Number(document.getElementById("progress_width").value);
            document.getElementById("progress_width").value = prog_width;
            $("#bar1").animate({ width: prog_width + "%" }, 10, function () {
                if (document.getElementById("bar1").style.width == "100%") {
                    $(".progress").fadeOut("slow");
                }
            });
        }

        else {
            set_ele(ele);
        }
    }

    function set_ele(set_element) {
        check_element(set_element);
    }

I notice this problem when I editing file, I want check my web and reload the page.我在编辑文件时注意到这个问题,我想检查我的 web 并重新加载页面。 I know there's a way using Ctrl+F5, but it's got a little trouble.我知道有一种使用 Ctrl+F5 的方法,但它有点麻烦。 I want only use F5 can reload my web successfully.我只想使用 F5 可以成功重新加载我的 web。

Thanks for anyone answering me.感谢任何人回答我。

In your browser, you can also use在您的浏览器中,您还可以使用

CTRL+Shift+R to reload the page and empty the cache. CTRL+Shift+R重新加载页面并清空缓存。
(⌘+Shift+R on Mac) (在 Mac 上是⌘+Shift+R)

Maybe it will solve your problem;)也许它会解决你的问题;)

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

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