[expand title="Fiction" rel="fiction" swaptitle="Is like non-non-fiction"]
[expandsub1 title="Star Wars" rel="submenu-highlander" swaptitle="Hyperspeed" expanded="true"]Target Content[/expandsub1]
[expandsub1 title="Star Trek" rel="submenu-highlander" swaptitle="Warpspeed"]Target Content[/expandsub1]
[/expand]
Collapse-O-Matic Grey Bar Style
Here is an example of how to pimp the collapse-o-matic expand to use a grey bar style using CSS.
Be sure you are using the div ad your default tag in the plugin settings.
The CSS:
.greybar {
border: 1px dotted #aaaaaa;
padding: 7px;
background-position: 98% center;
background-color: #cccccc;
}
The Code:
[expand trigclass="arrowright greybar" title="Monkeys Are Fast"]...[/expand]
To give the target content a border, use the targclass attribute:
The CSS:
.blueborder {
border: 1px dotted blue;
border-top: none;
margin-left: 0;
padding: 5px;
}
The Code:
[expand trigclass="arrowright greybar" targclass="blueborder" title="Monkeys Are Fast"]...[/expand]
.de_flag {
background-image: url(https://lipis.github.io/flag-icon-css/flags/4x3/de.svg);
background-size: 64px 16px;
background-repeat: no-repeat;
background-position: -10px center;
padding: 7px 7px 7px 42px;
}
then add the new class to the trigclass attribute:
[expand trigclass="arrowright greybar de_flag" title="Deutschland"]...[/expand]
Collapse-O-Matic Inline Trigger with Block Target
Shortcode
This is an example of some text that has a trigger placed inline, meaning that the trigger does not break the flow of the text. However, when this triggerhidden content is clicked and the target is expanded, the target would break the paragraph as a display: block element. Naturally, when the element is collapsed, the inline flow returns.
...However, when [expand tag="span" title="this trigger" targtag="span"]hidden content[/expand] is clicked...
The Roll-Your-Own Method
This is an example of some text that has a trigger placed inline, using the roll-your-own method. However, when this trigger hidden content is clicked and the target is expanded, the target would break the paragraph as a display: block element. Naturally, when the element is collapsed, the inline flow returns.
...However, when <span title="this trigger" class="collapseomatic" id="testme2">this trigger</span><span class="collapseomatic_content" id="target-testme2">hidden content</span>
is clicked...
Collapse-O-Matic External Triggers for Nested Element
Here is a nested expand to test this issue.
[expand title="Level 1" id="q1" rel="top-highlander" trigclass="must-be-one" expanded="true"]
[expandsub1 title="Nested Level a1" id="a1" rel="a-highlander"]answer a1[/expandsub1]
[expandsub1 title="Nested Level a2" id="a2" rel="a-highlander"]answer a2[/expandsub1]
[/expand]
[expand title="Level 2" id="q2" rel="top-highlander" trigclass="must-be-one"]
[expandsub1 title="Nested Level b1" id="b1" rel="b-highlander"]answer b1[/expandsub1]
[expandsub1 title="Nested Level b2" id="b2" rel="b-highlander"]answer b2[/expandsub1]
[/expand]
Here are some external triggers:
<a class="expandanchor" href="#q1">Level 1</a>
<a class="expandanchor" href="#a1">Level 1a</a>
<a class="expandanchor" href="#a2">Level 1b</a>
<a class="expandanchor" href="#q2">Level 2</a>
<a class="expandanchor" href="#b1">Level 2a</a>
<a class="expandanchor" href="#b2">Level 2b</a>
Collapse Grid Test
here we go:
[[collapse_grid cat_id="4" count="5"/]]
[collapse_grid cat_id=”4″ count=”5″/]
Collapse-O-Matic, Graphene Theme & Any Mobile Switcher Test
First let’s test the mobile-only and mobile-exclude shortcodes to see if they are included with the plugin. No, they are not.
Now we install the Graphene Theme and test…
Oops, wrong Graphene Theme. It seems This Theme is all that is required for testing the shortcodes.
Mobile Only
[[mobile only]...[/mobile-only]]
[mobile only]
this is some text that should only show up on mobile devices[/mobile-only]
Mobile Exclude
[[mobile exclude]...[/mobile-exclude]]
[mobile-exclude]
this is some text that should only show up on non-mobile devices[/mobile-exclude]
Collapse-O/Pro-Matic Slider Effect and Duration Attributes
Currently the slide effect and duration can be set globally under the plugin settings, but what if we want to set it individually per collapse element? We need the ability to add this via a shortcode attribute and as a data attribute for the roll-your-own method.
Shortcode Attributes
Default animation_effect is slideFade and duration is fast. As of version 1.7.3 these can be overridden using two new attributes: animation_effect and duration. Since using a shortcode will save the default effect and speed to a variable, we need to set up a separate test for the roll-your-own method
[expand title="Monkeys"]...[/expand]
[expand title="Donkeys" duration="slow"]...[/expand]
[expand title="Ninjas" animation_effect="slideToggle"]...[/expand]
Collapse-O/Pro-Matic Highlander Must Be One
As of Collapse-O-Matic version 1.7.2 and Collapse-Pro-Matic version 1.3.2 we have added the ability to force one element to stay open in a highlander grouping. Simply add the class must-be-one
to all the triggers in a highlander group using the trigclass attribute like so:
Shortcode
[expand title="Monkeys" rel="animal-highlander" trigclass="must-be-one"]...[/expand]
[expand title="Donkeys" rel="animal-highlander" trigclass="must-be-one"]...[/expand]
[expand title="Ninjas" rel="animal-highlander" trigclass="must-be-one"]...[/expand]
Example
Collapse-O-Matic CSS Tricks .colomat-close
When an expand element is expanded it has the .colomat-close class assigned. This class is removed when the expand element is collapsed. So, if you want to adjust how an active/expanded trigger is displayed, simply define your custom css as follows:
/*inactive/collapsed */
.collapseomatic {
}
/*active/expanded */
.collapseomatic.colomat-close {
}
Simple Demo
Using the trigclass attribute we can further assign the design of the triggers for only specific expand elements.
CSS
.collapseomatic.my_special_class {
color: green;
}
.collapseomatic.my_special_class.colomat-close {
color: red;
border: 2px dotted red;
}
Shortcode
[expand title="Trigger Text" trigclass="my_special_class"]Hidden Content[/expand]
Result
Nested Collapse Elements with Highlander Grouping
Here is a typical nested collapse group with highlander grouping
[expand title="state1" id="state1" togglegroup="state-highlander"]
[expandsub1 title="city1" id="city1" togglegroup="city-highlander"]bar1 bar2[/expandsub1]
[expandsub1 title="city2" id="city2" togglegroup="city-highlander"]bar3 bar4[/expandsub1]
[/expand]
[expand title="state2" id="state2" togglegroup="state-highlander"]
[expandsub1 title="city3" id="city3" togglegroup="city-highlander"]bar5 bar6[/expandsub1]
[expandsub1 title="city4" id="city4" togglegroup="city-highlander"]bar7 bar8[/expandsub1]
[/expand]
Notice how the main level and nested sub-elements have their own highlander grouping defined. This makes it so the main level items do not affect the nested children expand/collapse states.
This is how it works:
Now to do the exact same thing using the roll-your-own method:
<div class="collapseomatic" id="state1" title="state1" data-togglegroup="state-highlander">state1</div>
<div id="target-state1" class="collapseomatic_content">
<div class="collapseomatic" id="city1" title="city1" data-togglegroup="city-highlander">city1</div>
<div id="target-city1" class="collapseomatic_content">bar1 bar2</div>
<div class="collapseomatic" id="city2" title="city2" data-togglegroup="city-highlander">city2</div>
<div id="target-city2" class="collapseomatic_content ">bar3 bar4</div>
</div>
<div class="collapseomatic" id="state2" title="state2" data-togglegroup="state-highlander">state2</div>
<div id="target-state2" class="collapseomatic_content">
<div class="collapseomatic" id="city3" title="city3" data-togglegroup="city-highlander">city3</div>
<div id="target-city3" class="collapseomatic_content">bar5 bar6</div>
<div class="collapseomatic " id="city4" title="city4" data-togglegroup="city-highlander">city4</div>
<div id="target-city4" class="collapseomatic_content">bar7 bar8</div>
</div>