How to expand/collapse text in WYSIWYG w/CKEditor In full nodes of a certain content type (using panels), I would like to display a text summary with a read more link to display full text, then a show less link to collapse.  I had smart trim enabled which allowed a read more link, but the page simply reloaded to the trimmed summary after clicking the link. I am using WYSIWYG with CKEditor.

So far I have tried jquery expander and expanding formatter.  Jquery expander didn't have any affect on the full text, expanding formatter displayed an ellipsis at the designated trim spot, followed by the full text, and a read more button after the full text.  So, essentially neither worked.

I tried js injector, plus this code and the full text showed -- no effect.

Is there something about WYSIWYG or CKeditor that prevents this function?  Suggestions?
This worked for me
JS Injector
(function ($) {  

$(document).ready(function() {
    // Configure/customize these variables.
    var showChar = 100; // How many characters are shown by default
    var ellipsestext = &quot;...&quot;;
    var moretext = &quot;Show more &gt;&quot;;
    var lesstext = &quot;Show less&quot;;
    

    $('.more').each(function() {
        var content = $(this).html();
 
        if(content.length &gt; showChar) {
 
            var c = content.substr(0, showChar);
            var h = content.substr(showChar, content.length - showChar);
 
            var html = c + '&lt;span class=&quot;moreellipses&quot;&gt;' + ellipsestext+ '&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;morecontent&quot;&gt;&lt;span&gt;' + h + '&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;&quot; class=&quot;morelink&quot;&gt;' + moretext + '&lt;/a&gt;&lt;/span&gt;';
 
            $(this).html(html);
        }
 
    });
 
    $(&quot;.morelink&quot;).click(function(){
        if($(this).hasClass(&quot;less&quot;)) {
            $(this).removeClass(&quot;less&quot;);
            $(this).html(moretext);
        } else {
            $(this).addClass(&quot;less&quot;);
            $(this).html(lesstext);
        }
        $(this).parent().prev().toggle();
        $(this).prev().toggle();
        return false;
    });
$(&quot;.morecontent span&quot;).css(&quot;display&quot;, &quot;none&quot;);
$(&quot;.morelink&quot;).css(&quot;display&quot;, &quot;block&quot;);
})
})(jQuery);


CKeditor
    &lt;span class=&quot;more&quot;&gt;
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;more&quot;&gt;
      Morbi placerat imperdiet risus quis blandit. Ut lobortis elit luctus, feugiat erat vitae, interdum diam. Nam sit amet arcu vitae justo lacinia ultricies nec eget tellus. Curabitur id sapien massa. In hac &lt;a href=&quot;#&quot;&gt;habitasse&lt;/a&gt; platea dictumst. Integer tristique leo consectetur libero pretium pretium. Nunc sed mauris magna. Praesent varius purus id turpis iaculis iaculis. Nulla &lt;em&gt;convallis magna nunc&lt;/em&gt;, id rhoncus massa ornare in. Donec et feugiat sem, ac rhoncus mauris. Quisque eget tempor massa.
    &lt;/div&gt;