Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(option?) use CSS position: fixed whenever possible for navigation bars #51

Open
jokeyrhyme opened this issue Sep 3, 2011 · 4 comments
Milestone

Comments

@jokeyrhyme
Copy link

The scrolling area touch-event hack is necessary on iOS and Android<2.3, but many devices support CSS position: fixed.

In my own testing, web applications have much better performance characteristics for content in the scrolling pane. I've noticed that the web forms kitchen-sink widgets' animations are smoother when compared to the touch-event hacked technique.

This might be a solution to:
#22

@davebalmer
Copy link
Owner

Good point. This is doable today, but not automatic. Would be good to make this easier.

@jokeyrhyme
Copy link
Author

According to this, CSS position: fixed support is undetectable:
https://github.com/Modernizr/Modernizr/wiki/Undetectables

However, in the example for Modernizr.addTest(), they give example code that actually tends to work in a few browsers (although I've noticed it produced false-positives in iOS):
http://www.modernizr.com/docs/#addtest

I'm using the example code with some hard coded user-agent sniffing, which is also what the Wink Toolkit does (although they have a slightly more interesting detection mechanism involving getBoundingClientRect).

@jokeyrhyme jokeyrhyme reopened this Sep 4, 2011
@jokeyrhyme
Copy link
Author

Oops, wrong button.

@davebalmer
Copy link
Owner

I use user-agent sniffing in my sample apps for this. In one of my apps, I use this to change to native scrolling:

// turn off flick based scrolling
if (!jo.matchPlatform("ios ipad iphone hpwos webos playbook android bada playbook")) {
    joDOM.loadCSS("css/browser.css");
    joScroller.prototype.onDown = function() {};
}

The browser.css file here just reverts back to overflow: auto for divs, but the same sort of approach could be used to also change from position: absolute to position: fixed for certain elements. This sort of thing is something I could see moving into the core library, but I want to do it cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants