Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Add ability to toggle a subparagraph
I like the paragraph toggle that Dave Winer uses on his blog — for example — and wonder where I’d start to have similar functionality in Txp. Is there a plugin, or code? (I’ve not done any jquery coding, so that would be new to me.)
Last edited by mistersugar (2011-07-29 16:55:09)
Offline
Re: Add ability to toggle a subparagraph
In your <head>, somewhere after jQuery is included:
<script type="text/javascript">
jQuery(document).ready(function(){
$('.post .subsection').click(function() {
$(this).next().toggle('slow');
return false;
}).next().hide();
});
</script>
This assumes your articles are wrapped in some element (like a div) with class=“post”.
In your CSS:
.subsection-content {display:none}
In your article:
h3(subsection). Click here for additional notes on the topic.
p(subsection-content). Here is the additional content.
I’ll let you take it from there…CSS styling or whatever…but that’s a simple way to do it.
Last edited by maruchan (2011-07-29 17:10:03)
Offline
Re: Add ability to toggle a subparagraph
Thanks. Will try this tonight.
Offline
Pages: 1