Skip to content

itoufo/jquery.get-background-size.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery.getBackgroundSize.js

import

<script src="scripts/jquery.getBackgroundSize.js"></script>

Basic Usage

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);

Referring to Selected Element

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>');
  });
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published