Dimensions Now in jQuery Core

The Dimensions plugin was originally started by Paul Bakuas. By popular demand my offset plugin was merged with the Dimensions plugin. From that point on I contributed several other methods to Dimensions and helped maintain the plugin with Paul. Dimensions became one of the most widely depended on plugins by developers and other plugins. It was a very common request to have Dimensions moved into the core to help relieve plugin dependency issues. We started by moving the most popular methods into the core but that wasn’t enough. The plugin was still a very common dependency. As of SVN Revision 5345 the Dimensions plugin has been merged into the jQuery core. You can find the documentation for the current Dimensions plugin on the jQuery documentation wiki.

Getting the Scrollbar Width

I've been asked a few times if Dimensions would provide a method for getting the scrollbar width. In Dimensions 1.0 I created an internal method for finding the scrollbar width to hack around some browser limitations. I eventually found other ways around those limitations and that code is no longer in Dimensions. I know that in some unusual cases it can be useful, so I want to go ahead and provide that code as one of my jQuery snippets. It is just a single method added to the jQuery namespace called getScrollbarWidth.

  1. $.getScrollbarWidth();

Here is an example of it and here is the small script.

jQuery.batch Plugin

jQuery methods, in most cases, operate on zero or more matched elements. Getter type methods are an exception. The getter methods only return the results for the first matched element. This is overwhelmingly the typical use-case. However, sometimes you might want to get the results for all matched elements in the jQuery collection. Introducing jQuery.batch, a small extension to jQuery that adds such functionality.

Read the rest of this entry »

New Plugin: Live Query

Live Query, previously called Behavior, utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.

For example you could use the following code to bind a click event to all A tags, even any A tags you might add via AJAX or a script.

Read the rest of this entry »

Dimensions 1.1.2

Release early, release often. In the 1.1.1 update there was a regression in Safari with calculating the window width and height. I also fixed a bug in getting the offset of table cells with borders in Mozilla. As usual, you can report bugs, request features and download Dimensions 1.1.2 from the Dimensions project page.

Dimensions 1.1.1

I just released Dimensions 1.1.1 which fixes up an issue when trying to get the document width and height. Grab the zip from the Dimensions project page.

Dimensions 1.1

I just released Dimensions 1.1. It includes a new option to include margins for the outerWidth and outerHeight methods. I've also fixed the issues with Safari 3 and the offset method. This update does require jQuery 1.1.3 or greater. Feel free to grab the zip from the Dimensions project page. Oh and the docs have been updated for 1.1.

Dimensions 1.0.1

I just released Dimensions 1.0.1. It fixes an issue with fixed position elements in Opera and makes it easier to run the test suite locally.

You can download the zip from the Dimensions project page.

Dimensions 1.0

Dimensions 1.0 is final! This is a very big release for Dimensions and includes a lot of bug fixes, new features, an automated test suite and docs. Yup, even docs! So what new features have been added to Dimensions in 1.0?

Read the rest of this entry »

Dimensions 1.0rc1

Hot on the heels of the jQuery 1.1.3 release, here is Dimensions 1.0 release candidate 1! Dimensions 1.0rc1 includes several key new features.

  • A new method, called position, to get the positioned offset of an element
  • A new lite option to the offset method that runs much faster
  • The offset method now works on the body element
  • The scrollTop and scrollLeft methods are now setters and getters
  • A new test suite
  • Updated documentation
  • And lots of bug fixes

Still to come are more documentation and examples! You can grab Dimensions 1.0rc1 from the Dimensions project page.