Reputation: 13850
I'm wondering if I can figure out if a CSS3 property is doable in user's web browser
like:
if($('#element').css('-moz-transform', 'rotateX(180deg')){ //Do something }
Above example does not work. If it is not possible how do I detect the browser using javascript? For example, webkit browser like Chrome and Safari or Mozilla browser?
Upvotes: 1
Views: 96
Reputation: 168655
It's not JQuery, but my suggestion would be to use the Modernizr Javascript library.
It does exactly what you're asking, being able to detect support for a wide range of browser features which may or may not be available in various browsers, including CSS 2D transforms.
It adds a range of classes to your <body>
element so you can set CSS styles according to feature support, and it also makes available a Javascript object with all the feature support flags, which you can query at any point.
Upvotes: 2
Reputation: 22395
It might be possible using getComputedStyle
but it's far easier to use a plugin that unifies all the browser differences in CSS3. One good plugin is the jQuery transform plugin
Upvotes: 1