summaryrefslogtreecommitdiff
path: root/themes/default/jquery/jquery.ui.init.js
blob: 1806cb10615d70e71b6d4766dbe454a3c5e4e3d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * Initialize UI elements
 * 
 * @todo Write helpers to grab all jQuery UI components by class and initialize
 */

$("document").ready(function() {

  /**
   * Reset width of sized photos wider than their 
   * parent container so that they fit
   */
  if ($("#gItem").length) {
    var containerWidth = $("#gItem").width();
    var oPhoto = $("#gItem img").filter(function() {
      return this.id.match(/gPhotoID-/);
    })
    if (containerWidth < oPhoto.width()) {
      var proportion = containerWidth / oPhoto.width();
      oPhoto.width(containerWidth);
      oPhoto.height(proportion * oPhoto.height());
    }
  }

});