summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJed Foster <jed@jedfoster.com>2013-09-21 21:08:34 -0700
committerJed Foster <jed@jedfoster.com>2013-09-21 21:23:48 -0700
commita94c7743f8607639fe72dab2eb2dbf23cb4583cf (patch)
tree17a3ce4d7c74933acbfc9b2383944afd70371468
parentadcf5376db39f270774d384b41411016bb24b184 (diff)
downloadReadmore.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.md1
-rw-r--r--demo.html1
-rw-r--r--readmore.js3
3 files changed, 4 insertions, 1 deletions
diff --git a/README.md b/README.md
index cd75b53..fdad850 100644
--- a/README.md
+++ b/README.md
@@ -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)
diff --git a/demo.html b/demo.html
index 55ac51f..7bc4a21 100644
--- a/demo.html
+++ b/demo.html
@@ -51,6 +51,7 @@
<li><code>maxHeight: 200</code> (in pixels)</li>
<li><code>moreLink: '&lt;a href="#"&gt;Read more&lt;/a&gt;'</code></li>
<li><code>lessLink: '&lt;a href="#"&gt;Close&lt;/a&gt;'</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');