Splitview for iPad Safari?

Discussion in 'Web Design and Development' started by CavemanUK, Jan 25, 2013.

  1. macrumors 6502

    CavemanUK

    Joined:
    Jun 29, 2006
    Location:
    Rhyl, North Wales
    #1
    Is there a way to create a splitview using html5 and css3? something similar to the settings menu on ipads. So you have a scrollable list down the left hand side and a static details page on the right. its specifically for an ipad webapp. im looking at jquery mobile currently but cant see a way to do that. a shame as everything else in jqm looks awesome and is easy to code.
     
  2. macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #2
    The key is to create 2 div containers mimicking a frame set, and apply "position: absolute; overflow: scroll" (or auto) to the scrollable list and "position:fixed; overflow: auto" to the static details page. See the tested/working code below and of course up to you to play with the positioning and overflow and sizes to suit your needs. Tis is a demo of the concept, not a perfect iPad template, please be informed. But still cool!

    :cool:

    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>My Fake iPad Settings Menu</title>
    <style type="text/css">
    
    body{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%; 
    max-height: 100%; 
    }
    
    #framecontent{
    position: absolute;
    top: 0;
    bottom: 0; 
    left: 0;
    width: 200px; /*Width of frame div*/
    height: 100%;
    overflow: scroll; /*Disable or enable scrollbars. Set to "scroll" to enable*/
    background: navy;
    color: white;
    }
    
    #maincontent{
    position: fixed;
    top: 0; 
    left: 200px; /*Set left value to WidthOfFrameDiv*/
    right: 0;
    bottom: 0;
    overflow: auto; 
    background: #fff;
    }
    
    .innertube{
    margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
    }
    
    * html body{ /*IE6 hack*/
    padding: 0 0 0 200px; /*Set value to (0 0 0 WidthOfFrameDiv)*/
    }
    
    * html #maincontent{ /*IE6 hack*/
    height: 100%; 
    width: 100%; 
    }
    
    </style>
    
    
    </head>
    
    <body>
    
    <div id="framecontent">
    <div class="innertube">
    
    <h1>CSS Left Frame Layout</h1>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    <h3>Sample text here</h3>
    
    </div>
    </div>
    
    
    <div id="maincontent">
    <div class="innertube">
    
    <h1>Setting for sample text (fake)</h1>
    
    </div>
    </div>
    
    
    </body>
    </html>
    
     

Share This Page