Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery <html> class to trigger 3D transforms
    text
    copied!<p>I am looking for a nice method to cue css3 3d transforms, by adding classes to the html tag using JQuery. I have a menu like this:</p> <pre><code>&lt;ul&gt; &lt;li class="menu1"&gt;&lt;a href="#"&gt;Item 1&lt;/a&gt;&lt;/li&gt; &lt;li class="menu2"&gt;&lt;a href="#"&gt;Item 2&lt;/a&gt;&lt;/li&gt; &lt;li class="menu3"&gt;&lt;a href="#"&gt;Item 3&lt;/a&gt;&lt;/li&gt; &lt;li class="menu4"&gt;&lt;a href="#"&gt;Item 4&lt;/a&gt;&lt;/li&gt; &lt;li class="menu5"&gt;&lt;a href="#"&gt;Item 5&lt;/a&gt;&lt;/li&gt; &lt;li class="menu6"&gt;&lt;a href="#"&gt;Item 6&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>For example if '.menu1 a' is clicked, I'd like to add the class 'show1' to the html tag. 'show2' if '.menu2 a' is clicked etc.</p> <p>However for my transitions to work correctly I also need another class to be added, then removed after a set time like 3 seconds. So if '.menu1 a' is clicked, the html class would be 'show1 zoom' for 3 seconds, then just 'show1'. And if '.menu2 a' is clicked, the html class would be 'show2 twirl' for example.</p> <p>I don't mind setting the name of the transition (zoom, twirl, etc.) manually in the script, but if it's easier/neater I could use a system of classes on the li, like 'menu1 p-show1 t-zoom'.</p> <p>I have a half-working example <a href="http://codepen.io/daviestar/pen/tpoJc" rel="nofollow">here</a>. If you inspect the html tag (click gear beside html) and change the html class from 'show1' to 'show2 zoom' you will see the desired transition, which should be the cube rotating to the correct side (.show2) and also a fancy transition (.zoom) on top. Everything is working correctly except the .js which I can't get working at all!</p> <p><strong>New demo <a href="http://static.houseofyum.co.uk/cube/" rel="nofollow">here</a>.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload