Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;main&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;style type="text/css"&gt; .panel1 {display:inline;} .panel2 {display:none;} &lt;/style&gt; &lt;script type="text/javascript"&gt; function panelTransition(panelOut,panelIn) { // panelIn gets turned on setDisplay(panelIn,"inline"); // panelOut gets turned off setDisplay(panelOut,"none"); } function setDisplay(className,displayState) { // retrieve a list of all the matching elements var list = document.getElementsByClassName(className); // step through the list for(i=0; i&lt;list.length; i++) { // for each element, set the display property list[i].style.display = displayState; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;img class="panel1" src="1.gif" onclick="panelTransition('panel1','panel2')" /&gt; &lt;img class="panel2" src="2.gif" onclick="panelTransition('panel2','panel1')" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Or you can accomplish the same in jQuery</p> <pre><code>// fires when the page is up and running $(document).ready(function(){ // find all the panel1 elements, // attach an on click handler $(".panel1").bind("click", function(){ // find all the panel1 elements // set their css display property to inline $(".panel1").css("display","inline"); // find all the panel2 elements // set their css display property to none $(".panel2").css("display","none"); }); $(".panel2").bind("click", function(){ $(".panel2").css("display","inline"); $(".panel1").css("display","none"); }); }); </code></pre> <p>You can learn all about jQuery here : <a href="http://www.jquery.com/" rel="nofollow">http://www.jquery.com/</a></p> <p>You'll only be able to get your code to run once, as soon as you click a panel1 image all of the panel2 images will disappear, you won't be able to click them back on ever again.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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