JSFiddle - React, Tailwind, and code Playground

http://stackoverflow.com/questions/7277763/issue-finding-background-position-with-jquery

by tw16

HTML

<div id="fake"></div>
<div id="fake2"></div>
<div id="fake3"></div>
<div id="fake4"></div>
<div id="fake5"></div>

CSS

#fake{
    height: 50px;
    width: 50px;
    background: skyblue 10px 20px;
}
#fake2{
    height: 50px;
    width: 50px;
    background: salmon;
    background-position: 5px 15px;
}
#fake3{
    height: 50px;
    width: 50px;
    background: grey;
    background-position: 0 0;
}
#fake4{
    height: 50px;
    width: 50px;
    background: black;
}
#fake5{
    height: 50px;
    width: 50px;
    background-color: orange;
}

JavaScript

var bPos = $('#fake').css("backgroundPosition"),
    bPos2 = $('#fake2').css("backgroundPosition"),
    bPos3 = $('#fake3').css("backgroundPosition"),
    bPos4 = $('#fake4').css("backgroundPosition"),
    bPos5 = $('#fake5').css("backgroundPosition");

alert('fake1=' + bPos + '  ' + 'fake2=' + bPos2 + '  ' + 'fake3=' + bPos3 + '  ' + 'fake4=' + bPos4 + '  ' + 'fake5=' + bPos5)