0

@TheSystem 这里是代码看看并解决它

<div class="fragment groupeditemspage">
    <header aria-label="Header content" role="banner">
        <button class="win-backbutton" aria-label="Back" disabled></button>
        <h1 class="titlearea win-type-ellipsis">
            <span class="pagetitle"><b>OvalFox </b>News Reader</span>
        </h1>
    </header>
    <section aria-label="Main content" role="main">
    <progress class="win-ring withText" id="loadingIndicator"></progress>
        <div class="groupeditemslist" aria-label="List of groups" data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div>
    </section>
</div>

上面是 html 代码,如果你看到它包含进度标签,当我启动 Windows 8 应用程序时它会显示进度条,一旦我点击任何项目以查看其详细信息,进度条会在内容加载后立即运行并隐藏页面,它打开没有问题,但是当我点击后退按钮时,这是哪个功能

navigated: function () {
                // Do application specific on-navigated work here
                var backButton = this.pageElement.querySelector("header[role=banner] .win-backbutton");
                if (backButton) {
                    backButton.onclick = function () { nav.back(); };

                    if (nav.canGoBack) {
                        backButton.removeAttribute("disabled");
                    } else {
                        backButton.setAttribute("disabled", "disabled");
                    }
                }
            },

进度条出现在主页中,即使内容默认加载在页面上,也不会再次隐藏

这是进度条的javascript代码

for (var n = 0; n < items.length; n++) {
        var article = {};
        // Get the title, author, and date published.
        article.title = items[n].querySelector("title").textContent;
        article.author = items[n].querySelector("creator").textContent;
        article.date = items[n].querySelector("pubDate").textContent;
        var thumbs = items[n].querySelectorAll("content");
        article.content = items[n].querySelector("description").textContent;
        var staticContent = toStaticHTML(items[n].querySelector("description").textContent);
        var progressBar = document.getElementById("loadingIndicator").style.display = 'none';
        progressBar.value = 1;
        // Process the content so that it displays nicely.

        if (thumbs.length > 1) {
            article.thumbnail = thumbs[thumbs.length - 1].attributes.getNamedItem("url").textContent;

        }
        else {
            var firstindex = article.content.indexOf("<img");
            if (firstindex !== 1) {
                var secondindex = article.content.indexOf("src=", firstindex) + 5;
                var thirdindex = article.content.indexOf("\"", secondindex);
                article.thumbnail = article.content.slice(secondindex, thirdindex);
            }
        }

上面的代码包含以下代码部分

var progressBar = document.getElementById("loadingIndicator").style.display = 'none';
        progressBar.value = 1;

上面的代码是实际代码,用于在加载内容后立即隐藏进度条,但是一旦单击后退按钮,此功能就不起作用

希望从@TheSystem 和其他人那里得到关于这个详细而复杂的代码的帮助

4

1 回答 1

2

这段代码不符合你的想法:

var progressBar = document.getElementById("loadingIndicator").style.display = 'none';
progressBar.value = 1;

你要

var progressBar = document.getElementById("loadingIndicator");
progressBar.style.display = 'none';
progressBar.value = 1;
于 2013-02-16T21:19:55.440 回答