jQuery - Show Less/More, Going up and Down before "Show More" and Vice Versa
<p>can someone help me fix this problem ?
I just learn CSS and Js so I dont really know what to do.</p>

<p>this thing going up and down 2x before showing the content, then going up and down again before hide the content.</p>

<p>CSS:</p>

<pre><code>   .pureyad {
        max-width: 600px;
        line-height: 1.1em;
        font-family: 'Roboto Slab';
        overflow: hidden;
        background: #46988f;
        font-size: 14px;
        height: 120px;
        padding-left: 20px
    }

    .purgex {
        display: block;
        background: transparent;
        border: none;
        border-top: 1px solid #222;
        width: 585px;
        max-width: 100%;
        font-family: 'baloo bhai';
        font-size: 15px
    }
</code></pre>

<p>JS:</p>

<pre><code>function ssss() {
var text = $('.pureyad'),
     btn = $('.purgex'),
       h = text[0].scrollHeight; 

        if(h &gt; 120) {
        btn.addClass('less');
    }

    btn.click(function(e) 
    {
    e.stopPropagation(); 

    if (btn.hasClass('less')) {
        btn.removeClass('less');
        btn.addClass('more');
        btn.text('Show less');

      text.animate({'height': h});
  } else {
            btn.addClass('less');
            btn.removeClass('more');
            btn.text('Show more');
            text.animate({'height': '120px'});
        }  
    });
}
</code></pre>

<p>HTML : </p>

<pre><code>    &lt;div class="pureyad"&gt;
&lt;p&gt;Lorem ipsum dolor sit amet..&lt;/p&gt;
                &lt;/div&gt;
&lt;center&gt;&lt;button class="purgex" onclick="ssss()"&gt;Show more&lt;/button&gt;&lt;/center&gt;
</code></pre>

<p>Gif up and down: <a href="http://i.giphy.com/l0HlJmVHLDGnSZWuY.gif" rel="nofollow noreferrer">http://i.giphy.com/l0HlJmVHLDGnSZWuY.gif</a></p>

<hr>

<p>I get this script from reply post here : 
<a href="https://stackoverflow.com/a/38680734/5118751">https://stackoverflow.com/a/38680734/5118751</a> 
the script is working fine on Jsfiddle and also when i'm directly load the script on html.</p>