Sign In Register

How can we help you today?

Start a new topic
Answered

Dynamic Forms, expand/collapse-able controls

Is there any mechanic in place for creating expandable/collapsable controls in admin screens? Eg, when showing a list of script log events there isn't room to show multi-line messages, and i'd like to hook up a click on on item to expand it to show additional information.


Best Answer

It is possible in Javascript with the following function:


 

<script>
$(".spoiler .toggle").click(function(){
    $(this).siblings(".content").slideToggle();
    if ($(this).text() == "+| Show") {
        $(this).text("-| Hide");
    } else {
        $(this).text("+| Show");
    }
});
</script>

 and the html object would have

 

<div class="spoiler">
    <div class="toggle">+| Show</div>
    <div class="content" style="display:none"><hr />
        CONTENT GOES HERE
    </div>
</div>

 I haven't tested this myself with the handlebars, but it might put you on the right track.  It works fine in standard HTML5


Hi James,

 

Apologies for the delayed response. I'm not exactly sure if you can do this. I'll look into it and get back toy you.


Thanks,

Liam

Answer

It is possible in Javascript with the following function:


 

<script>
$(".spoiler .toggle").click(function(){
    $(this).siblings(".content").slideToggle();
    if ($(this).text() == "+| Show") {
        $(this).text("-| Hide");
    } else {
        $(this).text("+| Show");
    }
});
</script>

 and the html object would have

 

<div class="spoiler">
    <div class="toggle">+| Show</div>
    <div class="content" style="display:none"><hr />
        CONTENT GOES HERE
    </div>
</div>

 I haven't tested this myself with the handlebars, but it might put you on the right track.  It works fine in standard HTML5

Login to post a comment