Created
November 8, 2012 00:32
-
-
Save seyDoggy/4035641 to your computer and use it in GitHub Desktop.
Sample jquery plugin used at #KWDM
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
# plugin code | |
(function($){ | |
$.fn.myTallest = function(){ | |
var tallest = 0, | |
thisTallest = 0; | |
$(this).each(function(){ | |
thisTallest = $(this).height(); | |
if (thisTallest > tallest) tallest = thisTallest; | |
}).height(tallest); | |
return $(this); | |
}; | |
})(jQuery); | |
# sample usage | |
$(function(){ | |
$('.three .content').myTallest().css('color','red'); | |
$('.five .content').myTallest(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment