jquery - How to change transition effect based on android version? -


According to jquerymobile the flip effect is only supported in the last version of Android, how can I create the following button:

& lt; A href = "# ngame" data-roll = "button" data-transition = "flip" data-rel = "dialog" & gt; New game & lt; / A & gt;

Use the 'flip' effect only in Android 2.3.4+ and use the 'fade' effect on earlier versions?

If I help, then I am using PhoneGap in my project.

Thank you!

Step A phonegap must obtain the device's version of API ().

Step two is to parse it into an integer or a float number and decide whether to change the domain:

  var android_version = ParseFloat (device.version); If (android_version & lt; 2.3) {$ .each ($ ['[data-transition = "flip"]), function (index, value) {$ (value) .attr (' data-transition ',' fade ');}); }   

You can run it after the deviceready event fire, because device.version will not be ready until then. In addition, the flip effect will work on the older versions of Android OS, it only looks like a clunkey as it rotates the page as if it is doing a carthale instead of a three-dimensional flip.

- & gt; Note: You can also get Android OS version number in a webpad by checking the navigator.userAgent string. I found regex below another StackWorflow question:

[; (\ S) Android (\ d + (?: \. \ D +) +) [;)] The match against the Navigator.User Agent string gives me the following output: < / P>

  Android 2.3.3; 2.3.3    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -