Hi everyone
I'm new to using jqm to build a webapp for the ipad. I've read the docs and have a rough idea how the layouts work (i.e. page/header/content/footer) and have started pulling together a demo for a project I have on the go.
I've structured the index page as so:
- <div id="srf-homeheader">
- <img id="srf-head-image" src="img/src_header.png" />
- </div>
- <div id="srf-main-page" data-role="page">
- <div id="srf-content" data-role="content" >
- <ul id="main-menu-list">
- <li><a href="external-content-1.html"><img src="img/src_main_btn1.png" /></a></li>
- <li><a href="external-content-1.html"><img src="img/src_main_btn2.png" /></a></li>
- <li><a href="external-content-1.html"><img src="img/src_main_btn3.png" /></a></li>
- <li><a href="external-content-1.html"><img src="img/src_main_btn4.png" /></a></li>
- <li><a href="external-content-1.html"><img src="img/src_main_btn5.png" /></a></li>
- <li><a href="external-content-1.html"><img src="img/src_main_btn6.png" /></a></li>
- </ul>
- </div>
- </div>
- <div id="srf-footer">
- </div>
As you've probably spotted, I've purposely created a header and footer div
outside of the page div. Within the page div I have a content div, where I have some images that I use to link to external content files.
I've structured it this way because I always want the same header and footer image/html to remain on screen, with just the content area updating depending upon what link is clicked and when.
Clicking one of the external links will successfully pull in the external-content-1.html file content and slide it in to view - very nice - however I always see a flicker of the header and foot images. Note that as a test I added an <img> tag to the header and used a css background-image for the footer, but both continue to flicker.
The other thing of possible note here is that when I click back from the external content, and the above content page is reshown, the header/footer image does not flicker.
Also, when I click the external link or go back, I see that the content area size crops to some other size first. I suspect this is a css mistake on my part but I have set that content div to be the exact pixel size i require, so i'm not sure why the div (or another div) would resize when I click a link. Here's the css:
- html, body {
- height:768px;
- width:1024px;
- background-color:White;
-
- -webkit-user-select:none;
- -webkit-text-size-adjust:none;
- }
- div{
- background-color:White;
- }
- #dev_nav{
- position:absolute;
- left:0;
- top:20px;
- z-index:50;
- border:solid 1px black;
- line-height:2em;
- }
- #srf-homeheader{
- height:188px;
- width:1024px;
- margin:0;
- padding:0;
- display:block;
- position:absolute;
- top:0;
- left:0;
- right:0;
- bottom:188px;
- z-index:10;
- -webkit-box-shadow: 0 5px 5px #E5E5E5;
- }
- #srf-headheader img{
- width:1024px;
- height:188px;
- border:0;
- margin:0;
- padding:0;
- }
- #main-menu-list li{
- display:block;
- float:left;
- position:relative;
- }
- #main-menu-list li img{
- border:1px solid #E5E5E5;
- -webkit-box-shadow: 3px 3px 3px #E5E5E5;
- margin-right:15px;
- margin-top:15px;
- }
- #srf-content{
- height:530px;
- width:1024px;
- margin:0;
- padding:0;
- display:block;
- position:absolute;
- top:189px;
- left:0;
- right:0;
- bottom:50px;
- z-index:5;
- }
- #srf-footer{
- height:50px;
- width:1024px;
- margin:0;
- padding:0;
- display:block;
- position:absolute;
- top:718px;
- left:0;
- right:0;
- bottom:0;
- z-index:5;
- background-image:url(../img/src_footer.png);
- background-position:top left;
- background-repeat:no-repeat;
- }
I get the feeling I'm missing something blatantly obvious here but as a n00b I could do with someone pointing me in the right direction and/or commenting on my html structure, if it's incorrect.
Many thanks
Lee
p.s. I tried using a cache manifest file and defined the images by name in there, but still the flicker occurs. I think I saw somewhere that applying in the css a transform3d(0,0,0) on the image would also cache them but I havent tried this as yet.
p.p.s. this project is designed to run locally on an ipad, whereas i've been testing remotely for dev purposes - not sure if this would have anything to do with the flicker. (wouldnt expect so but mentioning just in case)