summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--readmore.js2
-rw-r--r--readmore.min.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/readmore.js b/readmore.js
index 13a0001..272893f 100644
--- a/readmore.js
+++ b/readmore.js
@@ -60,7 +60,7 @@
var current = $(this),
maxHeight = (current.css('max-height').replace(/[^-\d\.]/g, '') > current.data('max-height')) ? current.css('max-height').replace(/[^-\d\.]/g, '') : current.data('max-height'),
hightMargin = current.data('height-margin');
-console.log(current.data('height-margin'));
+
current.addClass('readmore-js-section');
if(current.css('max-height') != "none") {
diff --git a/readmore.min.js b/readmore.min.js
index a3b89b7..01fc2f7 100644
--- a/readmore.min.js
+++ b/readmore.min.js
@@ -1 +1 @@
-(function(e){function i(i,s){this.element=i;this.options=e.extend({},n,s);e(this.element).data("max-height",this.options.maxHeight);e(this.element).data("height-margin",this.options.heightMargin);delete this.options.maxHeight;if(this.options.embedCSS&&!r){var o=".readmore-js-toggle, .readmore-js-section { "+this.options.sectionCSS+" } .readmore-js-section { overflow: hidden; }";(function(e,t){var n=e.createElement("style");n.type="text/css";if(n.styleSheet){n.styleSheet.cssText=t}else{n.appendChild(e.createTextNode(t))}e.getElementsByTagName("head")[0].appendChild(n)})(document,o);r=true}this._defaults=n;this._name=t;this.init()}var t="readmore",n={speed:100,maxHeight:200,heightMargin:15,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:true,sectionCSS:"display: block; width: 100%;",startOpen:false,beforeToggle:function(){},afterToggle:function(){}},r=false;i.prototype={init:function(){var t=this;e(this.element).each(function(){var n=e(this),r=n.css("max-height").replace(/[^-\d\.]/g,"")>n.data("max-height")?n.css("max-height").replace(/[^-\d\.]/g,""):n.data("max-height"),i=n.data("height-margin");console.log(n.data("height-margin"));n.addClass("readmore-js-section");if(n.css("max-height")!="none"){n.css("max-height","none")}n.data("boxHeight",n.outerHeight(true));if(n.outerHeight(true)<r+i){return true}else{n.data("sliderHeight",r);var s=t.options.startOpen?t.options.lessLink:t.options.moreLink;n.after(e(s).on("click",function(e){t.toggleSlider(this,n,e)}).addClass("readmore-js-toggle"));if(!t.options.startOpen){n.css({height:r})}}})},toggleSlider:function(t,n,r){r.preventDefault();var i=this,s=newLink="",o=false,u=e(n).data("sliderHeight");if(e(n).height()==u){s=e(n).data().boxHeight+"px";newLink="lessLink";o=true}else{s=u;newLink="moreLink"}i.options.beforeToggle(t,n,o);e(n).animate({height:s},{duration:i.options.speed});e(t).replaceWith(e(i.options[newLink]).on("click",function(e){i.toggleSlider(this,n,e)}).addClass("readmore-js-toggle"));i.options.afterToggle(t,n,o)}};e.fn[t]=function(n){var r=arguments;if(n===undefined||typeof n==="object"){return this.each(function(){if(!e.data(this,"plugin_"+t)){e.data(this,"plugin_"+t,new i(this,n))}})}else if(typeof n==="string"&&n[0]!=="_"&&n!=="init"){return this.each(function(){var s=e.data(this,"plugin_"+t);if(s instanceof i&&typeof s[n]==="function"){s[n].apply(s,Array.prototype.slice.call(r,1))}})}}})(jQuery) \ No newline at end of file
+(function(e){function i(i,s){this.element=i;this.options=e.extend({},n,s);e(this.element).data("max-height",this.options.maxHeight);e(this.element).data("height-margin",this.options.heightMargin);delete this.options.maxHeight;if(this.options.embedCSS&&!r){var o=".readmore-js-toggle, .readmore-js-section { "+this.options.sectionCSS+" } .readmore-js-section { overflow: hidden; }";(function(e,t){var n=e.createElement("style");n.type="text/css";if(n.styleSheet){n.styleSheet.cssText=t}else{n.appendChild(e.createTextNode(t))}e.getElementsByTagName("head")[0].appendChild(n)})(document,o);r=true}this._defaults=n;this._name=t;this.init()}var t="readmore",n={speed:100,maxHeight:200,heightMargin:15,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:true,sectionCSS:"display: block; width: 100%;",startOpen:false,beforeToggle:function(){},afterToggle:function(){}},r=false;i.prototype={init:function(){var t=this;e(this.element).each(function(){var n=e(this),r=n.css("max-height").replace(/[^-\d\.]/g,"")>n.data("max-height")?n.css("max-height").replace(/[^-\d\.]/g,""):n.data("max-height"),i=n.data("height-margin");n.addClass("readmore-js-section");if(n.css("max-height")!="none"){n.css("max-height","none")}n.data("boxHeight",n.outerHeight(true));if(n.outerHeight(true)<r+i){return true}else{n.data("sliderHeight",r);var s=t.options.startOpen?t.options.lessLink:t.options.moreLink;n.after(e(s).on("click",function(e){t.toggleSlider(this,n,e)}).addClass("readmore-js-toggle"));if(!t.options.startOpen){n.css({height:r})}}})},toggleSlider:function(t,n,r){r.preventDefault();var i=this,s=newLink="",o=false,u=e(n).data("sliderHeight");if(e(n).height()==u){s=e(n).data().boxHeight+"px";newLink="lessLink";o=true}else{s=u;newLink="moreLink"}i.options.beforeToggle(t,n,o);e(n).animate({height:s},{duration:i.options.speed});e(t).replaceWith(e(i.options[newLink]).on("click",function(e){i.toggleSlider(this,n,e)}).addClass("readmore-js-toggle"));i.options.afterToggle(t,n,o)}};e.fn[t]=function(n){var r=arguments;if(n===undefined||typeof n==="object"){return this.each(function(){if(!e.data(this,"plugin_"+t)){e.data(this,"plugin_"+t,new i(this,n))}})}else if(typeof n==="string"&&n[0]!=="_"&&n!=="init"){return this.each(function(){var s=e.data(this,"plugin_"+t);if(s instanceof i&&typeof s[n]==="function"){s[n].apply(s,Array.prototype.slice.call(r,1))}})}}})(jQuery) \ No newline at end of file