23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The last piece is to notify the user when obtaining geolocation fails. We could do this with another<br />

flyout with a Retry button, or with an inline message as below. We would not use a message dialog in<br />

this case, however, because the message could appear in response to a user-initiated refresh action. A<br />

message dialog might be allowable on startup, but with an inline message combined with the flyout we<br />

already added we have all the bases covered.<br />

For an inline message, I’ve added a floating div that’s positioned about a third of the way down on<br />

top of the map. It’s defined in pages/home/home.html as follows, as a sibling of the map iframe:<br />

<br />

Location<br />

<br />

Unable to obtain geolocation;<br />

use the app bar to try again.<br />

<br />

The styles for the #floatingError rule in pages/home/home.css provide for its placement and<br />

appearance:<br />

#floatingError {<br />

display: none;<br />

float: left;<br />

-ms-grid-column: 1;<br />

-ms-grid-row: 2;<br />

-ms-grid-row-align: start;<br />

width: 100%;<br />

text-align: center;<br />

background-color: rgba(128, 0, 0, 0.5);<br />

margin-top: 20%;<br />

}<br />

Because this is placed in the same grid cell as the map with float style, it appears as a nice overlay:<br />

308

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!