Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Html</p> <pre><code>&lt;div class="box"&gt; &lt;p id="id_full_text" class="class_full_text"&gt; Full Text &lt;p&gt; &lt;a href="id_link_show_more" class="class_link_show_more"&gt;Show more&lt;/a&gt; &lt;p id="id_hide_text" class="class_hide_text"&gt; Hide Text &lt;p&gt; &lt;a href="id_link_hide" class="class_link_hide"&gt;Hide more&lt;/a&gt; &lt;/div&gt; </code></pre> <p>css</p> <pre><code>.class_hide_text, .class_link_hide {display: none;} </code></pre> <p>Jquery (in you have just 1 in the same page)</p> <pre><code>$('#id_link_show_more').click(function () { $('#id_full_text').hide(); // hide fullText p $('#id_link_show_more').hide(); //hide show button $('#id_hide_text').show('100'); // Show HideText p $('#id_link_hide').show('100'); // show link hide }); $('#id_link_hide').click(function () { $('#id_link_hide').hide(); // hide link hide $('#id_hide_text').hide(); // hide the hide Text $('#id_link_show_more').show('100'); //show ths show button $('#id_full_text').show('100'); // show fullText }); </code></pre> <p><strong>Jquery (if you have more than 1</strong> in the same page, because you don't want open all the hide divs in the page)</p> <pre><code>$('.class_link_show_more').click(function () { var the_parent = $(this).parent(); the_parent.children('.class_full_text').hide(); // hide fullText p the_parent.children('.class_link_show_more').hide(); //hide button the_parent.children('.class_link_hide').show('100'); // Show HideText p the_parent.children('.class_hide_text').show('100'); // Show HideText p }); $('.class_link_hide').click(function () { var the_parent = $(this).parent(); the_parent.children('.class_link_hide').hide(); // hide link hide the_parent.children('.class_hide_text').hide(); // hide hide text p the_parent.children('.class_link_show_more').show('100'); //Show link show the_parent.children('.class_full_text').show('100;); // show full text }); </code></pre> <p><strong>Note</strong>: the number into the show(x) is the time (millisecond) to show the div </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