von c.kuetbach am October 12, 2012

Just found a new bug in android 3.2 WebView:

Assume you have created a nice hybrid application with phonegap. You set the viewport, with minscale, maxscale and usescalable=no.

The width of the viewPort is set to device-width.

BUT, in android 3.2 apps, you can drag your app arround.

Nothing to find with weinre, the DOM looks great.

Then I removed an css attribute from body:

body{
    -webkit-transform: translate3d(0,0,0) rotate(0) scale(1);
}

And the problem was gone.

7618 Kommentare zu "Let your page move arround"

#19
Javier sagte:
August 31, 2015 at 07:19 pm

You can use any javascript lriarby you want, but the animations themselves must be written in CSS, not javascript. It is absolutely vital for mobile developers to learn CSS animation instead of javascript. The reason is that Javascript is actually very inefficient for animation, and it's only recently, with the proliferation of mobile browsers, that we are starting to notice this. You see, with a JS animation (e.g. created using jQuery's animate function), the javascript lriarby sets an interval timer (lets say, 33ms, which is about 30 frames per second), and on that interval, it figures out where the animated element should be, using complex math calculated by the CPU, and then puts it there. Unfortunately, if the CPU is too slow to do that calculation every interval, it gets backed up and the animation stutters. jQuery and other JS animation tools do some work to combat this, sensing a drop in frame rate and trying to make the interval wider, to give it more time to complete the calculations, but it's often too-little-too-late.On the other hand, when you do a CSS animation (e.g. using the transform or webkit-transform css properties), you leave it to the GPU to simply calculate where the element should be as often as it can. As soon as it calculates the element's new position and places it there, the GPU starts the calculation again. This means the animation is always as smooth as the GPU can possibly make it, no matter what. If you animate too many elements for the GPU to handle it may still have trouble, but instead of ugly stuttering, it will be a more graceful drop in framerate.Hope that helps.

Konnentieren

Ihre E-Mailadresse wird nicht publiziert.

Sie können die Markdown-Syntax nutzen.

Please enter the letters as they are shown in the image above.
Letters are not case-sensitive.