// JavaScript Document
(function ($) { var divgrowid = 0; $.fn.divgrow = function (options) { var options = $.extend({}, { initialHeight: 100, moreText: "Lees meer...", lessText: "Sluiten", speed: 1000 }, options); return this.each(function () { divgrowid++; obj = $(this); obj.css('height', options.initialHeight).css('overflow', 'hidden'); obj.after('<p class="divgrow-showless"></p><a href="#" class="divgrow-showmore' + " divgrow-obj-" + divgrowid + '"' + '></a>'); $("a.divgrow-showmore").text(options.moreText); $("." + "divgrow-obj-" + divgrowid).toggle(function () { var height = $(this).prevAll("div:first").attr('rel'); $(this).prevAll("div:first").animate({ height: height }, options.speed, function () { $(this).nextAll("p.divgrow-showless:first").fadeOut(); $(this).nextAll("a.divgrow-showmore:first").text(options.lessText); }); }, function () { $(this).prevAll("div:first").stop(true, false).animate({ height: options.initialHeight }, options.speed, function () { $(this).nextAll("p.divgrow-showless:first").stop(true, false).fadeIn(); $(this).nextAll("a.divgrow-showmore:first").stop(true, false).text(options.moreText); }); }); }); }; })(jQuery);
