IOS Div Momentum Scrolling Without Fixed Height (content Loaded Via Ajax)?
I am creating an iOS web app that has a fixed div (say 200px height) and the content inside of that scrolls. I don't like the default iOS scrolling, as it's not like the native scr
Solution 1:
What I currently do to overcome the dynamic height issue is setting the height after the DOM is updated. I do this by using the following code:
document.getElementById('content').style.height = window.innerHeight - getPosition('loading')[1] + "px";
In this example the main DIV is 'content' and I have a span right above that DIV called loading which it uses as a reference point since the header changes in size depending on what part of the webapp you are on. Below is the getPosition function:
function getPosition(who){
var e = document.getElementById(who);
var position = {x:0,y:0};
while (e) {
position.x += e.offsetLeft;
position.y += e.offsetTop;
e = e.offsetParent;
}
return [position.x , position.y];};
Additionally, I believe the zoom has been fixed since iOS 5.0.1.
Post a Comment for "IOS Div Momentum Scrolling Without Fixed Height (content Loaded Via Ajax)?"