iPhone: fixed div sticks in the middle of the page when coming back by “history.back(-1)”

Question!

Having a problem with fixed div using iPhone. I know that in iOS 5 the functionality for position:fixed has been added. My div is positioned at the top of the screen and behave pretty good, anyway, there are some bugs during scrolling.

But what actually makes me angry - it is the position of this div after coming back to the current page clicking on javascript:history.back(-1) link. The fixed div sticks in the middle of a screen. When I try to scrool, it jumps back on the right position.

Is there any cure for the bug?

PS. Sometimes the div is completely not visible after returning by history:back function. It shows up after scrolling. It seems to me a bit the same problem.

<div class='rlm fixed rlm-zindex'>
  <a href='http://webiste.com/' target='_new'>
    <img src='banner-960.png' class='jqwatch' border=0 />
  </a>
</div>

And CSS:

div.rlm {
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: auto;
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: solid 1px;
        }

div.rlm img {
            width: 100%;
            left: 0;
            right: 0;
        }

.fixed { position: fixed; }
.rlm-zindex { z-index: 5; }


Answers

Actually it seems to be a Bug!

There is a solution here, but you have to change the scrollto into onload or similar...

By : powtac


This video can help you solving your question :)
By: admin