How to detect CSS features
If we want to detect whether a CSS property supports
var dom = document.createelement (' P '), if (' Textshadow ' in Dom.style) { alert (' Support Textshadow attribute ')}else { alert (' Textshadow attribute ' not supported ')}
If we want to detect if the CSS3 property supports a value
var dom = document.createelement (' P ');d om.style.backgroundImage = ' linear-gradient (red, tan) '; Dom.style.backgroundImage) { alert (' supports this attribute value ');} else { alert (' Browser does not support this property value ')}
How to dynamically assign a CSS3 effect and support all major browsers
function Islider () {};/** * @returns {String} * @private */islider.transition_end_event = Null;islider.browser_prefix = Nu ll; (function () {var e = document.createelement (' fakeelement '); [[' Webkittransition ', ' webkittransitionend ', ' WebKit '], [' transition ', ' transitionend ', null], [' Moz Transition ', ' transitionend ', ' Moz '], [' otransition ', ' otransitionend ', ' O ']].some (function (t) {if (E. Style[t[0]]!== undefined) {islider.transition_end_event = t[1]; Islider.browser_prefix = t[2]; return true; } });}) ();/** * @param {string} prop * @param {string} value * @returns {string} * @public */islider.styleprop = function (prop, ISDP) {if (Islider.browser_prefix) {if (!! ISDP) {return islider.browser_prefix + IU (prop); } else {return '-' + islider.browser_prefix + '-' + prop; }} else {return prop; }};/** * @param {String} prop * @param {HTMLELement} dom * @param {String} value * @public */islider.setstyle = function (DOM, prop, value) {Dom.style[islider.styl Eprop (prop, 1)] = value;};/ * * @type {Object} * * @param {htmlelement} dom the wrapper <li> element * @param {String} axis Animate Direction * @param {Number} scale Outer wrapper * @param {number} I wrapper ' index * @param {number} offset Move distance * @protect ed */islider._animatefuncs = {normal: (function () {function Normal (DOM, axis, scale, I, offset) { Islider.setstyle (DOM, ' transform ', ' Translatez (0) Translate ' + axis + ' (' + (offset + scale * (i-1) + ' px) '); } normal.effect = Islider.styleprop (' transform '); return normal; })()};
Information
CSS Secrets
Islider Line 250
How to detect CSS features
If we want to detect whether a CSS property supports
var dom = document.createelement (' P '), if (' Textshadow ' in Dom.style) { alert (' Support Textshadow attribute ')}else { alert (' Textshadow attribute ' not supported ')}
If we want to detect if the CSS3 property supports a value
var dom = document.createelement (' P ');d om.style.backgroundImage = ' linear-gradient (red, tan) '; Dom.style.backgroundImage) { alert (' supports this attribute value ');} else { alert (' Browser does not support this property value ')}
How to dynamically assign a CSS3 effect and support all major browsers
function Islider () {};/** * @returns {String} * @private */islider.transition_end_event = Null;islider.browser_prefix = Nu ll; (function () {var e = document.createelement (' fakeelement '); [[' Webkittransition ', ' webkittransitionend ', ' WebKit '], [' transition ', ' transitionend ', null], [' Moz Transition ', ' transitionend ', ' Moz '], [' otransition ', ' otransitionend ', ' O ']].some (function (t) {if (E. Style[t[0]]!== undefined) {islider.transition_end_event = t[1]; Islider.browser_prefix = t[2]; return true; } });}) ();/** * @param {string} prop * @param {string} value * @returns {string} * @public */islider.styleprop = function (prop, ISDP) {if (Islider.browser_prefix) {if (!! ISDP) {return islider.browser_prefix + IU (prop); } else {return '-' + islider.browser_prefix + '-' + prop; }} else {return prop; }};/** * @param {String} prop * @param {HTMLELement} dom * @param {String} value * @public */islider.setstyle = function (DOM, prop, value) {Dom.style[islider.styl Eprop (prop, 1)] = value;};/ * * @type {Object} * * @param {htmlelement} dom the wrapper <li> element * @param {String} axis Animate Direction * @param {Number} scale Outer wrapper * @param {number} I wrapper ' index * @param {number} offset Move distance * @protect ed */islider._animatefuncs = {normal: (function () {function Normal (DOM, axis, scale, I, offset) { Islider.setstyle (DOM, ' transform ', ' Translatez (0) Translate ' + axis + ' (' + (offset + scale * (i-1) + ' px) '); } normal.effect = Islider.styleprop (' transform '); return normal; })()};