diff options
author | Jed Foster <jed@jedfoster.com> | 2014-02-09 12:59:54 -0800 |
---|---|---|
committer | Jed Foster <jed@jedfoster.com> | 2014-02-09 12:59:54 -0800 |
commit | ce591e2f0b849dcb48a5c165a96d935a08ae94e1 (patch) | |
tree | 4e1c9e9961ff8e39f9c7ef0fc7bdbf730b9b48af /readmore.js | |
parent | db4c5f4b613e6e9a0a1b25d14263c41223073492 (diff) | |
parent | f3df04f90007d2018d5c9546140bf4324a83a053 (diff) | |
download | Readmore.js-ce591e2f0b849dcb48a5c165a96d935a08ae94e1.zip Readmore.js-ce591e2f0b849dcb48a5c165a96d935a08ae94e1.tar.gz Readmore.js-ce591e2f0b849dcb48a5c165a96d935a08ae94e1.tar.bz2 |
Merge branch 'jackshakes-master'
Diffstat (limited to 'readmore.js')
-rw-r--r-- | readmore.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/readmore.js b/readmore.js index 0bf2119..1702369 100644 --- a/readmore.js +++ b/readmore.js @@ -11,6 +11,7 @@ defaults = { speed: 100, maxHeight: 200, + heightMargin: 16, moreLink: '<a href="#">Read More</a>', lessLink: '<a href="#">Close</a>', embedCSS: true, @@ -29,6 +30,7 @@ this.options = $.extend( {}, defaults, options); $(this.element).data('max-height', this.options.maxHeight); + $(this.element).data('height-margin', this.options.heightMargin); delete(this.options.maxHeight); @@ -63,7 +65,8 @@ $(this.element).each(function() { 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'); + 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'); current.addClass('readmore-js-section'); @@ -73,7 +76,7 @@ current.data("boxHeight", current.outerHeight(true)); - if(current.outerHeight(true) < maxHeight) { + if(current.outerHeight(true) <= maxHeight + hightMargin) { // The block is shorter than the limit, so there's no need to truncate it. return true; } |