rpheath (owner)

Revisions

gist: 77018 Download_button fork
public
Public Clone URL: git://gist.github.com/77018.git
Embed All Files: show embed
jquery.adjust_height_with_sidebar.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// jQuery plugin
// - will adjust a content area to be at least as
// tall as the sidebar area
// Ex:
// $('#content').adjustHeightWithSidebar()
// $('#content').adjustHeightWithSidebar({sidebar_selector: '#side-bar'})
 
(function($) {
  $.fn.adjustHeightWithSidebar = function(options) {
    settings = $.extend({
      sidebar_selector: '#sidebar'
    }, options)
    
    var content_height = $(this).height(),
        sidebar_height = $(settings.sidebar_selector).height()
    
    return this.each(function() {
      if (sidebar_height > content_height)
        $(this).height(sidebar_height)
    })
  }
})(jQuery)