diff options
author | Jed Foster <jed@jedfoster.com> | 2013-09-21 21:08:34 -0700 |
---|---|---|
committer | Jed Foster <jed@jedfoster.com> | 2013-09-21 21:23:48 -0700 |
commit | a94c7743f8607639fe72dab2eb2dbf23cb4583cf (patch) | |
tree | 17a3ce4d7c74933acbfc9b2383944afd70371468 | |
parent | adcf5376db39f270774d384b41411016bb24b184 (diff) | |
download | Readmore.js-a94c7743f8607639fe72dab2eb2dbf23cb4583cf.zip Readmore.js-a94c7743f8607639fe72dab2eb2dbf23cb4583cf.tar.gz Readmore.js-a94c7743f8607639fe72dab2eb2dbf23cb4583cf.tar.bz2 |
Expose section CSS as a config option. Closes #13
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | demo.html | 1 | ||||
-rw-r--r-- | readmore.js | 3 |
3 files changed, 4 insertions, 1 deletions
@@ -22,6 +22,7 @@ Yes, it's that simple. You can change the speed of the animation, the height of * `maxHeight: 200` (in pixels) * `moreLink: '<a href="#">Read more</a>'` * `lessLink: '<a href="#">Close</a>'` +* `sectionCSS: 'display: block; width: 100%;'` (sets the styling of the blocks) * `beforeToggle: function() {}` (called after a more or less link is clicked, but *before* the block is collapsed or expanded) * `afterToggle: function() {}` (called *after* the block is collapsed or expanded) @@ -51,6 +51,7 @@ <li><code>maxHeight: 200</code> (in pixels)</li> <li><code>moreLink: '<a href="#">Read more</a>'</code></li> <li><code>lessLink: '<a href="#">Close</a>'</code></li> + <li><code>sectionCSS: 'display: block; width: 100%;'</code> (sets the styling of the blocks)</li> <li><code>beforeToggle: function() {}</code> (called after a more or less link is clicked, but <i>before</i> the block is collapsed or expanded)</li> <li><code>afterToggle: function() {}</code> (called <i>after</i> the block is collapsed or expanded)</li> </ul> diff --git a/readmore.js b/readmore.js index 20fc294..c8d6873 100644 --- a/readmore.js +++ b/readmore.js @@ -13,6 +13,7 @@ maxHeight: 200, moreLink: '<a href="#">Read More</a>', lessLink: '<a href="#">Close</a>', + sectionCSS: 'display: block; width: 100%;', // callbacks beforeToggle: function(){}, @@ -28,7 +29,7 @@ delete(this.options.maxHeight); - var styles = '.readmore-js-toggle, .readmore-js-section { display: block; width: 100%; } .readmore-js-section { overflow: hidden; }'; + var styles = '.readmore-js-toggle, .readmore-js-section { ' + this.options.sectionCSS + ' } .readmore-js-section { overflow: hidden; }'; (function(d,u) { var css=d.createElement('style'); |