- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How Can I add +/- symbols or icons on an expanding / collapsing custom module?
SOLVEJan 25, 2018 1:57 PM - edited Jan 25, 2018 3:46 PM
I'd like to add + / - symbols or icons (e.g. triangle/inverted triangle, or chevron/inverted chevron) indicating to a user that a text box can be expanded and collapsed. Any ideas on how I can program that into my custom module in Hubl?
Here's my snippet so far (it works without the function mentioned above).
<div class="hs-accordion-wrapper clearfix {% if widget.expand %}expand{% endif %}"> <div class="accordion-title"> <h3>{{ widget.title }}</h3> </div> <div class="two-col-right-wrapper clearfix"> <div class="feature-text col1"> <div class="feature-image"> {% if widget.left_column_image.src %} <a title="{{ widget.left_column_image.alt }}" href="{{ widget.left_column_image.src }}" rel="lightbox"> <img src="{{ widget.left_column_image.src }}" width="{{ widget.left_column_image.width }}" height="{{ widget.left_column_image.height }}" alt="{{ widget.left_column_image.alt }}"> </a> {% endif %} <br> click the image above to view larger version </div> </div> <div class="feature-text col2"> {{ widget.right_column_content }} </div> </div> </div>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Jan 26, 2018 8:27 AM - edited Jan 26, 2018 8:28 AM
Hello there!
I haven't tried this on actual, but perhaps this might give you a bit of a jumpstart with what you're trying to achieve:
<div class="hs-accordion-wrapper clearfix {% if widget.expand %}expand{% endif %}"> <div class="accordion-title"> <h3>{{ widget.title }}</h3> </div> <div class="two-col-right-wrapper clearfix"> <div class="feature-text col1"> <div class="feature-image"> {% if widget.left_column_image.src %} <a title="{{ widget.left_column_image.alt }}" href="{{ widget.left_column_image.src }}" rel="lightbox"> <img src="{{ widget.left_column_image.src }}" width="{{ widget.left_column_image.width }}" height="{{ widget.left_column_image.height }}" alt="{{ widget.left_column_image.alt }}"> </a> {% endif %} <br> click the image above to view larger version </div> </div> <div class="feature-text col2"> {{ widget.right_column_content }} </div> </div> </div> <style> .accordion-title { cursor: pointer; /* make the div a bit more clickable when hovered */ } .accordion-title h3:before { content: "+"; /* initial state when the expand option is not enabled */ padding: 0 5px; } .expand .accordion-title h3:before { content: "-"; /* will show when expand option is enabled */ } .two-col-right-wrapper { display: none; } .expand .two-col-right-wrapper { display: block; } </style> <script type="text/javascript"> $(document).ready(function(){ var wrapper = $('.hs-accordion-wrapper'); var title = $('.accordion-title'); title.click(function(){ wrapper.toggleClass('expand'); }); }); </script>
Let me know if this works or if there's a bit more tinkering needed, I'd be glad to help you out!
Kind regards,
Louie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Feb 16, 2018 7:00 PM
Hi there,
I've just sent you a private message so you could share it in there.
Thanks,
Louie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content