Permalink
Browse files

initial

  • Loading branch information...
0 parents commit 17f28361650537c1d5306a09848a9a0a34e5b145 @tdreyno committed Apr 22, 2011
Showing with 30 additions and 0 deletions.
  1. +2 −0 README
  2. +28 −0 jquerytools.scrollable.autoheight.js
2 README
@@ -0,0 +1,2 @@
+1. Get jQuery Tools Scrollable
+2. $('.scrollable').scrollable().autoheight();
@@ -0,0 +1,28 @@
+(function($) {
+
+$.setScrollableRootHeight = function(api, index, method) {
+ method = method || "animate";
+
+ var item = api.getItems().eq(index),
+ root = api.getRoot();
+
+ root.stop()[method]({ height: item.height() });
+}
+
+// $('.scrollable').scrollable().autoheight();
+$.fn.autoheight = function() {
+ return this.each(function() {
+ var api = $(this).data("scrollable");
+
+ api.onSeek(function(e, index) {
+ $.setScrollableRootHeight(api, index);
+ });
+
+ $(window).load(function() {
+ $.setScrollableRootHeight(api, 0, "css");
+ api.seekTo(0, 0);
+ });
+ });
+};
+
+})(jQuery);

0 comments on commit 17f2836

Please sign in to comment.