Answered by:
Flyout issue: no text show up

Question
-
I just follow the flyout sample code and add a flyout in my project. Everything works fine, just no text show up in the flyout. I run the sample code project in my machine and the text can show up. Below is the snapshot of my flyout.
The code is as below:
html:<div id="confirmFlyout" data-win-control="WinJS.UI.Flyout" aria-label="{Confirm purchase flyout}"> <div>Your account will be charged $252.</div> <button id="confirmButton">OK</button> </div>
css:
.win-flyout:not(.win-menu) button, .win-flyout:not(.win-menu) input[type="button"] { margin- margin- float: right; background-color:blueviolet; color:greenyellow; }
Great Wall
- Moved by Rob Caplan [MSFT]Microsoft employee, Moderator Sunday, October 28, 2012 8:22 PM coding question, not a design question (From:UI Design for Windows Store apps)
Sunday, October 28, 2012 6:26 PM
Answers
-
Hi,
Please refer to the example as follow:
<!DOCTYPE html> <html> <head> <title>flyout example</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <!-- ListViewExample references --> <script type="text/javascript" src="/flyout/default.js"></script> <style type="text/css"> .win-flyout:not(.win-menu) .win-type-x-large { font-weight: 300; margin-top: -13px; padding-bottom: 18px; } /* Flyout buttons. */ .win-flyout:not(.win-menu) button, .win-flyout:not(.win-menu) input[type="button"] { margin-top: 16px; margin-left: 20px; float: right; } </style> </head> <body> <!-- <div style="height:90px;width:50px;"></div>--> <!-- Button that launches the confirmation Flyout. --> <button class="action" id="buyButton">Buy</button> <!-- Confirmation Flyout. --> <div id="confirmFlyout" data-win-control="WinJS.UI.Flyout" aria-label="{Confirm purchase flyout}"> <div>Your account will be charged $252.</div> <button id="confirmButton">Complete Order</button> </div> <body> </html>
(function () { "use strict"; var app = WinJS.Application; var activation = Windows.ApplicationModel.Activation; WinJS.strictProcessing(); app.onactivated = function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { // TODO: This application has been newly launched. Initialize // your application here. } else { // TODO: This application has been reactivated from suspension. // Restore application state here. } args.setPromise(WinJS.UI.processAll().then(function completed() { // addEventListener document.getElementById("buyButton").addEventListener("click", showConfirmFlyout, false); document.getElementById("confirmButton").addEventListener("click", confirmOrder, false); })); } }; app.oncheckpoint = function (args) { // TODO: This application is about to be suspended. Save any state // that needs to persist across suspensions here. You might use the // WinJS.Application.sessionState object, which is automatically // saved and restored across suspension. If you need to complete an // asynchronous operation before your application is suspended, call // args.setPromise(). }; function showConfirmFlyout() { showFlyout(confirmFlyout, buyButton, "top"); } function showFlyout(flyout, anchor, placement) { flyout.winControl.show(anchor, placement); } function confirmOrder() { document.getElementById("confirmFlyout").winControl.hide(); } app.start(); })();
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework- Marked as answer by Song Tian Tuesday, October 30, 2012 2:21 AM
Monday, October 29, 2012 8:37 AM
All replies
-
Hi,
Please refer to the example as follow:
<!DOCTYPE html> <html> <head> <title>flyout example</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <!-- ListViewExample references --> <script type="text/javascript" src="/flyout/default.js"></script> <style type="text/css"> .win-flyout:not(.win-menu) .win-type-x-large { font-weight: 300; margin-top: -13px; padding-bottom: 18px; } /* Flyout buttons. */ .win-flyout:not(.win-menu) button, .win-flyout:not(.win-menu) input[type="button"] { margin-top: 16px; margin-left: 20px; float: right; } </style> </head> <body> <!-- <div style="height:90px;width:50px;"></div>--> <!-- Button that launches the confirmation Flyout. --> <button class="action" id="buyButton">Buy</button> <!-- Confirmation Flyout. --> <div id="confirmFlyout" data-win-control="WinJS.UI.Flyout" aria-label="{Confirm purchase flyout}"> <div>Your account will be charged $252.</div> <button id="confirmButton">Complete Order</button> </div> <body> </html>
(function () { "use strict"; var app = WinJS.Application; var activation = Windows.ApplicationModel.Activation; WinJS.strictProcessing(); app.onactivated = function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { // TODO: This application has been newly launched. Initialize // your application here. } else { // TODO: This application has been reactivated from suspension. // Restore application state here. } args.setPromise(WinJS.UI.processAll().then(function completed() { // addEventListener document.getElementById("buyButton").addEventListener("click", showConfirmFlyout, false); document.getElementById("confirmButton").addEventListener("click", confirmOrder, false); })); } }; app.oncheckpoint = function (args) { // TODO: This application is about to be suspended. Save any state // that needs to persist across suspensions here. You might use the // WinJS.Application.sessionState object, which is automatically // saved and restored across suspension. If you need to complete an // asynchronous operation before your application is suspended, call // args.setPromise(). }; function showConfirmFlyout() { showFlyout(confirmFlyout, buyButton, "top"); } function showFlyout(flyout, anchor, placement) { flyout.winControl.show(anchor, placement); } function confirmOrder() { document.getElementById("confirmFlyout").winControl.hide(); } app.start(); })();
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework- Marked as answer by Song Tian Tuesday, October 30, 2012 2:21 AM
Monday, October 29, 2012 8:37 AM -
Thanks. Issue is resolved by changing the font color.
Great Wall
Monday, October 29, 2012 10:26 PM