Alternatively, what if you did this:
- <script type='text/javascript'>
- <!--
- $(document).bind('mobileinit',function(){
- $.extend( $.mobile , {
- defaultPageTransition: "none"
- });
- });
- //-->
- </script>
and
- <style type='text/css'>
- <!--
- html { background-color: #333; }
- @media only screen and (min-width: 1025px){
- .ui-page {
- width: 960px !important;
- margin: 0 auto !important;
- position: relative !important;
- border-right: 5px #666 outset !important;
- border-left: 5px #666 outset !important;
- }
- }
- -->
- </style>
Setting the
defaultPageTransition to "none" is needed because with large margins on the left and right slide transitions don't look so good.
In the CC, I used a
min-width of 1025 so as to not invoke it on a landscape mode iPad. The 960px width is used as sort of a standard width used by designers who use 960GS and the like. Having the margins and borders only on the sides avoids an unnecessary scroll bar. The relative positioning combined with the auto side margins centers it.
It may still be a bit wide and look too much like a stretched mobile app, so I may push this down to somewhere in the 720/768px width range, if I adopt this, depending on how it ends up looking in a landscape iPad.
Am I missing anything important that would cause this to break? Quick testing didn't show me any immediate problems in Chrome, Safari, mobile Safari or Android, but I haven't tested extensively and I'm not a whiz on the JQM internals.
-- JimB. aka Brons