-
Notifications
You must be signed in to change notification settings - Fork 0
/
simpleExpand.min.js
2 lines (2 loc) · 1 KB
/
simpleExpand.min.js
1
2
(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):"object"===typeof exports?module.exports=b(require("jquery")):jQuery?window.simpleExpand=b(jQuery):console.log("Could not detect jQuery. Exiting.")})(function(b){var f={easing:"swing",speed:400},e={expand:function(a,c){var g=b(a);a=d[g.attr("data-expand-id")];var h,k;if(a.expanded){var l=h=k=0;var m="shrink"}else l=a.height,h=a.paddingTop,k=a.paddingBot,m="expand";a.expanded=!a.expanded;g.animate({height:l,"padding-top":h,"padding-bottom":k},
f.speed,f.easing,function(){"function"===typeof c&&c(g,m)});return e},isExpanded:function(a){return d[b(a).attr("data-expand-id")].expanded},settings:function(a){b.extend(f,a);return e},init:function(){b(".simpleExpand").each(function(){var a=b(this),c={id:d.length,height:a.height(),paddingTop:a.css("padding-top"),paddingBot:a.css("padding-bottom"),expanded:!1};a.css({height:0,"padding-top":0,"padding-bottom":0,overflow:"hidden"});a.attr("data-expand-id",c.id);d.push(c)});return e}},d=[];return e});