This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // determine if an element is COMPLETELY inside the current viewport. | |
| // surely, there must be an easier way | |
| $.expr[':']['in-viewport'] = function(element){ | |
| var $win = $(window), $el = $(element), | |
| // element calculations | |
| offset = $el.offset(), | |
| outerWidth = $el.outerWidth(), | |
| outerHeight = $el.outerHeight(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simple equal column heights | |
| // sets the height of each matched div to that of the tallest element in the collection | |
| // Usage: $("#div1, #div2, #div3").equalHeights(); | |
| $.fn.equalHeights = function(){ | |
| var heights = [], i = this.length; | |
| while(i--){ heights[i] = this.eq(i).height(); } | |
| return this.height(Math.max.apply(Math, heights)); | |
| } |
NewerOlder