none
html + js 滑出层问题 win8 RRS feed

  • 问题

  •  当点击show panel按钮的时候,整个页面变黑,看上去像是真个页面被隐藏了。很是奇怪。请求帮忙解决。

    WinJS.UI.Pages.define("/dealer/ShowPanel.html", {
            ready: function (element, options) {
                document.getElementById("runAnimation").addEventListener("click", togglePanelUI, false);
                myPanel = document.getElementById("myPanel");
                //document.getElementById("button2").addEventListener("click", togglePanelUI, false);
            }
        });

        var animating = WinJS.Promise.wrap();
        var myPanel;

        function togglePanelUI() {
            var runAnimation = document.getElementById("runAnimation")
            if (runAnimation.innerHTML === "Show panel") {
                runAnimation.innerHTML = "Hide panel";

                animating = animating
                    .then(function () {
                        myPanel.style.display = ''
                        return WinJS.UI.Animation.showPanel(myPanel);
                    });
            } else {
                runAnimation.innerHTML = "Show panel";

                animating = animating
                    .then(function () { return WinJS.UI.Animation.hidePanel(myPanel); })
                    .then(
                        function () { myPanel.style.display = "none"; });
            }
        }

    2013年1月22日 3:50

全部回复