JS based on browser support for CSS3 Mobile, select how to move elements

Source: Internet
Author: User

Implement IE9 move as margin, other options based on browser support for TRANSFOM

var movestyle= "margin"; var testdiv=document.createelement ("div"), var transform=[];//ie9 and above distinguish div element Recognition Oninput attribute if (" Oninput "in Testdiv" {//foreach function, invokes the array for each element and passes the element to the callback function ["", "MS", "Moz", "WebKit"].foreach (function (prefix) { Transform.push (prefix + (prefix?) "T": "T") + "Ransform");}); alert (transform);//for in statement traversal array or object property for (Var key in transform) {if (Transform[key] in Testdiv.style) {movestyle= Transform[key];}} alert (Movestyle);}

  

JS based on browser support for CSS3 Mobile, select how to move elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.