Wednesday, September 21, 2011

Using javascript to solve mobile browser position:fixed; issue

One of the website I am working on is using Clearbox to generate the lightbox effect. But because most of the mobile browsers does not work with position:fixed, so, when user browse the website from iPad or Android, the dialog box always popup at the top of the page (outside the current viewport). The same issue happens to every javascript library using position:fixed property.

There is no easy workaround yet.

So, I have to run the following script after every scroll event in order to update the "top" style of the popup window (keep updating even before the user click the lightbox link).

(include this script right before the </head>)

No comments:

Post a Comment