Responsive design with two pages in one on JQuery Mobile -


i'm trying create mobile application jquery mobile responsive design.

in other words, want, in smartphone, "page1.html" , "page2.html" loaded in separed pages :

 _________              __________ |page1    |             |page2    | |.html    |  on click   |.html    | |         | <---------  |         | |         |             |go    | |go    | on click    |page1 btn| |page2 btn| ----------> |         | |_________|             |_________| 

and, in tablets, want page1.html , page2.html loaded in same page :

----------------------------- |page1.html   | page2.html   | |                            | |                            | |                            | |                            | |                            | |---------------------------- 

how jquerymobile ? have try $.mobile.loadpage(url) , $.mobile.changepage(url) problem page replaced , need have 2 pages in single view tablets.

thanks per advance help.

its simple enough, @omar said, first of use single page template 'data-role=page' denoting each page.

<body>  <div data-role="page" data-theme="d" id="pageone">  <---header---->  <--- content --->  <---footer---->  </div>  <div data-role="page" data-theme="d" id="pagetwo">  <---header---->  <--- content --->  <---footer---->  </div> 

now, jquery mobile automatically show 'pageone' on first load , hide 'pagetwo' , on navigating 'pagetwo' hide 'pageone'.

after can write css media query similar this:

@media , (min-width: 450px) {    #pageone{     display:block;     float: left;     width:50%;     postion:relative;     }    #pagetwo{     display:inline-block;     float:right;     width:50%;     padding-left: 2em;     postion:relative;     } } 

so if width greater mentioned width(450px) have both pages displayed side side. hope helps. here simple working sample made.

http://jsfiddle.net/uwzpm/


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -