Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery show/addClass for many div with same class
    primarykey
    data
    text
    <p>So what I'm tring to do:</p> <p>HTML code:</p> <pre><code>&lt;div class="div_with_content"&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi congue lectus sed tortor placerat quis porttitor dui vehicula. Morbi molestie tortor sit amet eros tempor consectetur. &lt;/div&gt; &lt;div class="show_more_btn"&gt;Show more&lt;/div&gt; &lt;div class="div_with_content"&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi congue lectus sed tortor placerat quis porttitor dui vehicula. Morbi molestie tortor sit amet eros tempor consectetur. &lt;/div&gt; &lt;div class="show_more_btn"&gt;Show more&lt;/div&gt; &lt;div class="div_with_content"&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi congue lectus sed tortor placerat quis porttitor dui vehicula. Morbi molestie tortor sit amet eros tempor consectetur. &lt;/div&gt; &lt;div class="show_more_btn"&gt;Show more&lt;/div&gt; </code></pre> <p>CSS Code:</p> <pre><code>.showMore { display:block; } .div_with_content { display:none; } </code></pre> <p>So i got plenty of divs with class "div_with_content"(witch are not displayed) with some content, usually text. Below each "div_with_content" there is a button wrapped in div "show_more_btn". So when i press on div show_more_btn there will be style added (trought addClass in jQuery) of class showMore to show this div slowly. So its easy to achieve:</p> <p>JS CODE:</p> <pre><code>$(function() { $(".show_more_btn").click(function(event){ $(".div_with_content").addClass("showMore").show(1500,"swing"); }); }); </code></pre> <p>But there is only one problem: when I press whichever show_more_btn all div_with_content are slowly shown, not only one precisely over show_more_btn. So what i want: when i press "show_more_btn" only "div_with_content" precisly over "show_more_btn" is going to be shown others "div_with_content" are still not visible. How do I achieve that ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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