Collapseable descriptions for List/Links module (for FAQs)

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
8/26/2011 11:29:48 AM
Gravatar
Total Posts 6

Collapsible descriptions for List/Links module (for FAQs)

I wanted to use the Link/Links module for a FAQ page.  I didn't like the stock output, so I used a little jQuery to add the functionality.  It hides the description until the link is clicked.  This could be simpler, but the standard List/Link output makes the text hard to grab (not wrapped in anything).

Might be a good option to include for future releases.

Here's my code (I put it in a HTML Content module below the Link module)

<style>
.FAQ_text { color:#000; }
.link_handle { font-size:0.8em; }
</style>
<script>
$(document).ready(function() {
// This converts the MP list view into a list of links that expand to show the description.
    $("ul.linkitem li").each(function(){
        sTmp = $('ul.linkitem li').contents().filter(function() {return this.nodeType == 3;})
        .wrap('<div class="FAQ_text"></div>')
        .end()
        .filter('a');
    });
    $('ul.linkitem .mojolink').attr("href", "#")
        .click( function(){
            $('.FAQ_text', $(this).parent()  ).slideToggle()
            $('.link_handle', this).text($('.link_handle', this).text() == '(Click to view)' ? '(Click to hide)' : '(Click to view)');
    })
    .append("&nbsp;<span class='link_handle'>(Click to view)</span>")
    $('.FAQ_text').hide()
});
</script>

8/26/2011 11:39:52 AM
Gravatar
Total Posts 18439

Re: Collapseable descriptions for List/Links module (for FAQs)

We already have a Content Template with a very similar FAQ that you can see in action on our FAQ page, but it is just using a plain html module not the list/links feature.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.