10

Dimensions Plug-in

This is the outer dimensions box. It has the following CSS rule:

.dim-outer {
  height: 200px;
  width: 200px;
  margin: 10px;
  padding: 1em;
  border: 5px solid #e3e3e3;
  overflow: auto;
  font-size: 12px;
}

Scroll down for the inner dimensions box.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

This is the inner dimensions box.

This is the outer dimensions box. It has the following CSS rule:

.dim-outer {
        height: 200px;
        width: 200px;
        margin: 10px;
        padding: 1em;
        border: 5px solid #e3e3e3;
        overflow: auto;
        font-size: 12px;
      }

Scroll down for the inner dimensions box.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

This is the inner dimensions box.

Document & Window Dimensions

$(document).width(),
$('window').width()

Trigger

$(document).height(),
$(window).height()

Trigger

Element Dimensions

$('div.dim-outer').width(), $('div.dim-outer').height()

Trigger

$('div.dim-outer').innerWidth(), $('div.dim-outer').innerHeight()

Trigger

$('div.dim-outer').outerWidth(), $('div.dim-outer').outerHeight()

Trigger
move to top

scrollTop and scrollLeft

$(window).scrollLeft(), $(window).scrollTop()

Trigger

$('div.dim-outer').scrollLeft(), $('div.dim-outer').scrollTop()

Trigger
move to top

Offset

$('div.dim-outer').offset()

Trigger

$('div.dim-outer').offset({border: true})

Trigger

$('div.dim-outer').offset({border: true, padding: true})

Trigger

var theContent = $('#content')[0];
$('div.dim-outer').offset({border: true, padding: true, relativeTo: theContent})

Trigger

$('div.dim-inner').offset()

Trigger

$('div.dim-inner').offset({margin: true, padding: true, border: true})

Trigger

$('div.dim-outer').offset({}, returnObject)

full code:
var retObj = {};
$('div.dim-outer')
  .offset({padding: false}, retObj)
  .css('background','#ccc');
$(this).log(retObj);
Trigger
move to top

Position

$('div.dim-outer').position()

Trigger

$('div.dim-inner').position()

Trigger