js获取浏览器前缀

<script>
    var div = null;
    var _prefix = (function (temp) {
        var prefix = ["webkit", "Moz", "o", "ms"];
        var props = "";
        for (var i = 0; i < prefix.length; i++) {
            props = prefix[i] + "Transition";
            if (temp.style[props] !== undefined) {
                return "-" + prefix[i].toLowerCase() + "-";
            }
        }
        return false;
    })(document.createElement(div));

    console.log(_prefix);
</script>
posted @ 2016-05-13 09:59  豫见世家公子  阅读(557)  评论(0编辑  收藏  举报