I am creating a cross platform web app that will allow access to content in portrait and other interactive features in landscape. These will actually be two different HTML 5 apps.
I want to have two divs on index.html. One will load content/index.html and the other interactive/index.html.
Interactive will be hidden in portrait and content will be hidden in landscape.
Is it possible to use the jQuery load() method to accomplish this? I want them to both to load so that the user is able to return to where they left off in each view after each change in orientation.
Will something like the following work?
/* show portrait content only */
/* hide it landscape content */
@media screen and (min-device-width: 0px) and (max-device-width: 768px) and (orientation: portrait) {
#content { display: block; }
#interactive { display: none; }
}
/* show landscape content only */
/* hide portrait content */
@media screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
#content { display: none; }
#interactive { display: block; }
}
<div id="content"></div>
<script type="text/javascript">
$(function()
{
$("#content").load("content/index.html");
});
</script>
<div id="interactive"></div>
<script type="text/javascript">
$(function()
{
$("#interactive").load("interactive/index.html");
});
</script>