Skip to content

Commit

Permalink
Add backgroundPositionXY check
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlei committed Jun 5, 2012
1 parent 0338d1d commit 7efa3ee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions feature-detects/css-backgroundposition-xy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
Allan Lei https://github.com/allanlei
Check adapted from https://github.com/brandonaaron/jquery-cssHooks/blob/master/bgpos.js
Test: http://jsfiddle.net/allanlei/R8AYS/
*/
Modernizr.addTest('bgpositionxy', function() {
return Modernizr.testStyles('#modernizr {background-position: 3px 5px;}', function(elem) {
var cssStyleDeclaration = window.getComputedStyle ? getComputedStyle(elem, null) : elem.currentStyle;
var xSupport = (cssStyleDeclaration.backgroundPositionX == '3px') || (cssStyleDeclaration['background-position-x'] == '3px');
var ySupport = (cssStyleDeclaration.backgroundPositionY == '5px') || (cssStyleDeclaration['background-position-y'] == '5px');
return xSupport && ySupport;
});
});

0 comments on commit 7efa3ee

Please sign in to comment.