<script src="scripts/jquery.getBackgroundSize.js"></script>
Pass callback as an argument.
$(this).getBackgroundSize(function(arg){
console.log("width:" + arg.width);
console.log("height:" + arg.height);
}));
var callback = function(arg){
console.log("width:" + arg.width);
console.log("height:" + arg.height);
})
$(this).getBackgroundSize(callback);
Selected Element is assigned in "this".
$(function(){
$('#sample-auto-cover').getBackgroundSize(function(arg){
$(this).before('<table class="table">' +
'<tr><th>width</th><th>height</th></tr>' +
'<tr><td>' + arg.width + '</td><td>'+ arg.height + '</td></tr>' +
'</table>');
});
});