2012-11-02 45 views
1

我想爲我的javascript應用程序創建應用程序欄,因爲我們知道按下右鍵單擊時會看到應用程序欄,但我希望它在默認情況下顯示,無需單擊右鍵。這裏是我的html代碼Windows 8應用程序欄默認在應用程序開發中

<div id="appbar" data-win-control="WinJS.UI.AppBar"> 
    <!-- Commands for show/hide --> 
    <button data-win-control="WinJS.UI.AppBarCommand" 
      data-win-options="{id:'showHideButton', label:'Show/Hide Picker', icon:'view'}"> 
    </button> 
</div> 

謝謝

回答

0

在你的應用程序啓動代碼,獲得appbar元素,它調用"show()"

// This is essentially what you need to do inside your app startup code 
// After all the elements are loaded (After the WinJS.UI.processAll() I believe) 
document.getElementById('appbar').show(); 
+0

如果您在默認情況下啓用它,您很有可能希望它保持不變。在這種情況下,您將app bars sticky屬性設置爲true。 –

相關問題