Template:Simple FAQ

    Table of contents
    var AnswerBackGround = ($AnswerColor ?? $0 ?? '#bcd4ec');
    var QuestionBackGround = ($QuestionColor ?? $1 ?? '#ecf6fc');
    var AnswerSize = ($AnswerTextSize ?? $2 ?? '0.9em');
    var QuestionSize = ($QuestionTextSize ?? $3 ?? '1.5em');
    
    <p><label>'Quick Search:  '</label><input type="text" id="FilterTextBox" name="FilterTextBox" /></p>
    
    
    <html><head>
    <script type="text/javascript">"
    $(document).ready(function(){
        $('.tablefaq').attr('border',0);
        $('.tablefaq tr:even').addClass('tblQuestion');
        $('.tablefaq tr:odd').addClass('tblAnswer');
        $('.tblAnswerDiv').hide();
    
       $('tr.tblQuestion').click(function() {
           $('.arrow').removeClass('up');
           $('div.tblAnswerDiv').hide();
           $(this).find('.arrow').toggleClass('up');
           $(this).find('div.tblAnswerDiv').toggle();
           $('.tblAnswer').show();
       });
    
       $('.tablefaq tr:even').each(function() {
            var QuestionCnts = $(this).find('td').eq(0).html();
            var AnswerCnts = $(this).next('tr.tblAnswer').html();
        
            $(this).next('tr.tblAnswer').html('');
    
            $(this).find('td').eq(0).html('<span class=\"arrow\"></span><div class=\"tblQuestionDiv\">' + QuestionCnts + '</div><div class=\"tblAnswerDiv\">' + AnswerCnts + '</div><div>&nbsp</div>');
    
            $(this).find('td').eq(0).find('.tblAnswerDiv').hide();
        });
    
        
    
     //add index column with all content.
     $('.tablefaq tr:has(td)').each(function(){
       var t = $(this).text().toLowerCase(); //all row text
       $('<td class=\"indexColumn\"></td>')
        .hide().text(t).appendTo(this);
     });//each tr
     $('#FilterTextBox').keyup(function(){
       var s = $(this).val().toLowerCase().split(' ');
       //show all rows.
       $('.tablefaq tr:hidden').show();
       $.each(s, function(){
           $(\".tablefaq tr:visible .indexColumn:not(:contains('\" + this + \"'))\").parent().hide();
       });//each
     });//key up.
    
    });
    "</script>
    <style type="text/css">"
        .tablefaq {border-style:none; border:0;}
        .tblQuestion span.arrow { float:left; margin-top: 10px; margin-right:5px; background:transparent url(http://developer.mindtouch.com/@api/deki/files/4810/=arrows.png) no-repeat scroll 0px -16px; width:16px; height:16px; display:block;}
        .tblQuestion span.up { background-position:0px 0px;}
        .tblAnswerDiv {padding-left:20px; background:"..AnswerBackGround.."; font-size:"..AnswerSize.."; font-weight:normal; }
        .tblQuestionDiv { background:"..QuestionBackGround.."; font-size:"..QuestionSize.."; font-weight: bold; width=100%; } 
    "</style>
    </head></html>
    Tag page (Edit tags)
    • No tags
    You must login to post a comment.
    Powered by MindTouch Core