Collapse-O-Matic FAQ Trigger by Mouse Hover

Q: Can this work on mouseover or hover?

A: This is a question we get quite often. The plugin does not work with hover. We have created custom versions for clients in the past that does this, however you really need to think through how you will deal with touch devices that do not have a ‘hover’ state.

Also, when you hover over and item, how will your user close it? On mouse HoverOut is the easy answer, but then the user can never select or click on anything in the target area.

In short, it can be done but it’s a complex interaction that needs to be well planned out.

Here is an example of a plugin we custom built for a client.

Table of Contents Plus Test

Note: Currently de-activated to test Table of Content plugin.

This is a test that features a table of content from the Table of Contents Plus plugin as well as a collapse-o-matic expand element AND a collapse-commander element.
[toc wrapping=”right”]

This is an H1 heading

This is a heading

This is the content area and it has a collapse element in it:

[expand title="This is the expand element"]...and this is the target content[/expand]
This is the expand element
…and this is the target content

This is another h2 heading

This is an expand element element from Collapse Commander:

[expand cid="1398"/]
Test Expand Element
This is the content of the expand element early_oculous

This is a third h2 element

  • list item
  • list item
  • list item
  • list item

This is another H1 heading

Fourth heading element

Fifth heading, how do you like it?

Collapse-O/Pro-Matic CSS Tricks II – Font Awesome Arrows

First make sure Font Awesome is installed.

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

Or use a plugin such as Font Awesome Icons to have it installed for you.

We are going to use the following two Font Awesome Arrows:

<i class="fa fa-arrow-circle-down"></i>
<i class="fa fa-arrow-circle-up"></i>

Next we want to create a new class for these arrows. We are going to use the name awesomearrows. The class definitions need look like so:

.collapseomatic.awesomearrows {
    background-image: none;
}
.collapseomatic.awesomearrows:before {
    font-family: FontAwesome;
    content: "\f0ab";
}
.colomat-close.awesomearrows {
    background-image: none;
}
.colomat-close.awesomearrows:before {
    font-family: FontAwesome;
    content: "\f0aa";
}

Now we need to assign the trigclass attribute our value of ‘awesomearrows’

[expand title="Trigger Text" trigclass="awesomearrows"]Target Content[/expand]

Roll-Your-Own Nested Expands

Alternat Text be I

Here is a simple example of how you can create nested expand elements using the shortcode:

[expand title="state1" id="state1"]
   [expandsub1 title="city1" id="city1"]bar1
bar2[/expandsub1]
   [expandsub1 title="city2" id="city2"]bar3
bar4[/expandsub1]
[/expand]
state1
city1
bar1
bar2
city2
bar3
bar4

Roll-Your-Own

Here is a similar example of nested expand elements using the Roll-Your-Own method:

<div class="collapseomatic" id="state2" title="state2">state2</div>
<div id="target-state2" class="collapseomatic_content " style="display: none;">
   <div class="collapseomatic" id="city3" title="city3">city3</div><div id="target-city3" class="collapseomatic_content " style="display: none;">bar5<br>
bar6</div>
   <div class="collapseomatic" id="city4" title="city4">city4</div><div id="target-city4" class="collapseomatic_content " style="display: none;">bar7<br>
bar8</div>
</div>
state2

~~~

Here is a four level deep nested test using shortcodes:

+ Coaching (Team Services)

+ Coaching Engagements

Agile Team Accelerator

Expandsub4

this is the fourth estate

Embedded Agile Coaching

Technical Agile Coaching

Executive Session for Agile

Coaching Workshops

Sandbox

Collapse-O-Matic Lists

One of the more common support issues with Collapse-O-Matic are related to unwanted spacing between collapse elements. While there are a number of reasons why this happens, the most common issues are extra ‘p’ or ‘br’ tags being added due to the strange way the wpautop filter. Often the spacing issue can be resolved by wrapping the expand elements in a div, removing any extra spacing or hard-returns between the expand elements, adjusting css, using different expand html elements (such as the ‘li’ element), or using the Collapse Commander add-on.

Example of a simple list using Collapse-O-Matic:

[expand title="Item One"]
This is some special text to display about item one
[/expand]
[expand title="Item Two"]
This is some special text about item two to display
[/expand]
[expand title="Item Three"]
Item three also has some special text to be displayed
[/expand]
Item One
This is some special text to display about item one
Item Two
This is some special text about item two to display
Item Three
Item three also has some special text to be displayed

Example using UL and LI elements:

<ul>
[expand title="Item One" tag="li"]
This is some special text to display about item one
[/expand]
[expand title="Item Two" tag="li"]
This is some special text about item two to display
[/expand]
[expand title="Item Three" tag="li"]
Item three also has some special text to be displayed
[/expand]
</ul>
  • Item One
  • This is some special text to display about item one
  • Item Two
  • This is some special text about item two to display
  • Item Three
  • Item three also has some special text to be displayed

Example of a list using Collapse-Commander

[expand cid="1765"/]
[expand cid="1766"/]
[expand cid="1767"/]
Item One
This is some special text to display about item one
Item Two
This is some special text about item two to display with some html
Item Three
Item three also has some special text to be displayed

example of internal content list without using filter attribute:

[expand title="Standard"]
This is some text on the first line
This is some text on the second line
This is some text on the third line
[/expand]
Standard
This is some text on the first line
This is some text on the second line
This is some text on the third line

example of internal content list using filter attribute:

[expand title="Filtered" filter="true"]
This is some text on the first line
This is some text on the second line
This is some text on the third line
[/expand]
Filtered

This is some text on the first line
This is some text on the second line
This is some text on the third line

Collapse-O-Matic Image And Text Trigger

This is a test to see if both an image and text can be used as a trigger.

Shortcode:

[expand title="<img src='https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg'><br/>Trigger Text" trigclass="noarrow"]Hidden Target Content[/expand]

Hidden Target Content

Without Text

[expand title="<img src='https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg'>" trigclass="noarrow"]Hidden Target Content[/expand]

Hidden Target Content

Roll-Your-Own Method

With Text

<div class="collapseomatic noarrow" id="some_id_one" title="Hover over Trigger Text"><img src="https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg"/></br>Trigger Text</div>
<div id="target-some_id_one" class="collapseomatic_content ">Hidden Target Content</div>

Trigger Text
Hidden Target Content

Without Text

<img src="https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg" class="collapseomatic noarrow" id="some_id" title="Hover over Trigger Text">
<div id="target-some_id" class="collapseomatic_content ">Hidden Target Content</div>

Hidden Target Content

Roll-Your-Own Image Trigger with Swap Image

<img src="https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg" class="collapseomatic noarrow" id="some_other_id" title="Click to Expand">

<img src="https://spacedonkey.de/wp-content/uploads/2012/09/grillhead.jpg" class="collapseomatic noarrow" style="display:none" id="swap-some_other_id" title="Click to Collapse">

<div id="target-some_other_id" class="collapseomatic_content ">Hidden Target Content</div>

Hidden Target Content

Collapse-O-Matic – The Roll Your Own Method

Using the expand shortcode we can create a simple collapse-o-matic accordion element like so:

[expand title="Trigger Text"]Target Content[/expand]
Trigger Text
Target Content

Now, if we wanted to do the same thing but using the roll-your-own method we would have to create the elements manually:

<div class="collapseomatic " id="my_id"  title="Trigger Text">Trigger Text</div>
<div id="target-my_id" class="collapseomatic_content ">Target Content</div>
Trigger Text
Target Content

Now, we have the freedom to put the target element whatever we want: before, in or after the Trigger element. For example, here a link has been placed between the target and trigger:

<div class="collapseomatic" id="my_new_id"  title="Trigger Text">Trigger Text</div>
<a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/">Special Link</a>
<div id="target-my_new_id" class="collapseomatic_content ">Target Content</div>
Trigger Text

Special Link

Target Content

Now if we apply a bit of CSS magic, we can have the trigger and link display inline:

Magic CSS

Place the following css in the collapse-o-matic (or collapse-pro-matic) plugin options page, under Custom Style:

.magic_beans {
   display: inline;
   float: left;
   margin-right: 1.2em;
}

.clear {
   clear: both;
}

Roll-Your-Own Method w/ Magic CSS

<div class="collapseomatic magic_beans" id="my_unique_id"  title="Trigger Text">Trigger Text</div><a href="http://plugins.twinpictures.de/premium-plugins/collapse-pro-matic/" class="magic_beans">Collapse-Pro-Matic</a>
<div id="target-my_unique_id" class="collapseomatic_content clear">Target Content</div>

The Final Result

Trigger Text

Collapse-Pro-Matic

Target Content

Roll-Your-Own Method w/ Images

<img src="https://spacedonkey.de/wp-content/uploads/2016/01/2001_Space_Odysey-300x145.gif" class="collapseomatic noarrow" id="some_id" title="Hover over Trigger Text">
<div class="collapseomatic_content" id="target-some_id" >Target Content</div>

Required components:

  • Trigger:
    • class=”collapseomatic noarrow”
    • id=”some_id”
  • Target:
    • class=”collapseomatic_content”
    • id=”target-some_id”

Demo:

Target Content

Highlander Grouping

Highlander grouping is accomplished by adding data-group=”group_name-highlander” like so:

<div class="collapseomatic" id="monkey" data-group="animal-highlander" title="Monkeys">Monkeys</div>

<div id="target-monkey" class="collapseomatic_content">The monkey says Eek! Eek!</div>

<div class="collapseomatic" id="donkey" data-group="animal-highlander" title="Donkeys">Donkeys</div>

<div id="target-donkey" class="collapseomatic_content">The Donkey says Hee Haw</div>

Demo

Monkeys
The monkey says Eek! Eek!
Donkeys
The Donkey says Hee Haw

Collapse-Pro-Matic Expand UP Test

Above and Beyond

In this example we simply add the trigpos=”below” to place the trigger below the target area:

[expand id="aboveandbeyond" title="Above & Beyond" trigpos="below"]This is an example of an expand element that has the trigger below the target.[/expand]

This is an example of an expand element that has the trigger below the target.
Above & Beyond

Up Up & Away

In this example we will use the roll-your-own method to not only place the trigger below the target, but also:

  1. position the target absolutely so that the trigger does not move down
  2. attempt to make the content animate UP from the trigger

HTML
<div id="absolute">
<div id="target-upaway" class="collapseomatic_content">This is an example of an expand element that will "Slide Up" on top of the trigger when expanded and "Slide Down" into the trigger when collapsed.</div>
<div id="upaway" class="collapseomatic">Up Up & Away</div>
</div>

Notice that we have wrapped both the target and trigger elements in a div that has been assigned the id of “absolute”. We give this wrapping div absolute positioning and anchor it so many pixels off the bottom of the page using the following CSS:

CSS
#absolute {
position: absolute;
bottom: 60px;
padding-bottom:2%;
z-index: 100;
}

This is an example of an expand element that will “Slide Up” on top of the trigger when expanded and “Slide Down” into the trigger when collapsed.
Up Up & Away

Collapse-O-Matic Button Test

There are a couple of ways a button can be used as a collapse-o-matic trigger:

using a stylized div

Push me
this is the hidden content

shortcode:

[expand title="Push me" trigclass="noarrow my_button" targclass="my_content" tag="div"]this is the hidden content[/expand]

css:

.my_button {
background: #4B55E3;
color:  white;
padding:  5px;
width: 130px;
text-align: center;
}

.my_button.colomat-hover{
 background: #999;
text-decoration: none;
}

.my_content{
margin-left: 0;
}

Using a html button:

shortcode:

[expand title="Push me" trigclass="noarrow my_button" targclass="my_content" tag="button"]this is the hidden content[/expand]

this is the hidden content

Collapse-O-Matic Multi Triggers & Targets

Multiple Triggers

Add the format extra[n]-id to add extra external triggers for a single target:
<div id="test" class="collapseomatic">Trigger 1</div>
<div id="target-test" class="collapseomatic_content">You might think you can catch a monkey, but you can't. Monkeys are FAST!</div>
<div id="extra1-test" class="collapseomatic">Trigger 2</div>
<div id="extra2-test" class="collapseomatic">Trigger 3</div>

which should produce a little something like:

Trigger 1
You might think you can catch a monkey, but you can’t. Monkeys are FAST!
Trigger 2
Trigger 3

Multiple Targets

Multiple targets are available only in the Collapse-Pro-Matic plugin. To add extra targets, assign the ID in the format of target[n]-id as follows:
<div id="target1-monkey" class="collapseomatic_content">content</div>
<div id="monkey" class="collapseomatic">Trigger</div>
<div id="target2-monkey" class="collapseomatic_content">content</div>

which should produce a little something like:

You might think you can catch a monkey, but you can’t. Monkeys are FAST!
Trigger
You might still think you can catch a monkey, but you really can’t. Monkeys are still FAST!