Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:18:54+00:00 2026-06-06T17:18:54+00:00

Im having a website with long paragraphs, and Im looking for a way to

  • 0

Im having a website with long paragraphs, and Im looking for a way to make the initial presentation shorter, so I would like a plugin that gives me the option to expand/contract the text.

I already found something similar, like this: http://jtsnake.github.com/jquery-readmore/ but it doesnt do the rollback funciton.

Is there something similar I could use? Thanks all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:18:55+00:00Added an answer on June 6, 2026 at 5:18 pm

    I’d actually never made a plugin for this sort of action, so I decided I’d give it a shot, here’s what I came up with ->

    function($){
      $.fn.clipped = function(options){ 
        var settings = $.extend({
          'text' : this.text(),
          'start' : 0,
          'end' : 255,
          'showFrom': 255,
          'readMoreText': 'Read More',
          'readLessText': 'Read Less'     
        }, options);
    
      return this.each(function(){
        var $this = $(this);
            var origTxt = settings.text;
        var clippedTxt = origTxt.slice(settings.start, settings.end) + "<div class='read-hidden' style='display:none;opacity:0;'>" + $this.text().slice(settings.showFrom) +"</div><span class='read-clipped'>....<a href='#' class='read-click'>"+settings.readMoreText+"</a></span>";
        $this.html(clippedTxt);
    
        $('body').on('click', 'a.read-click', function(){
          if($('.read-hidden').css('display') == 'none'){
                //true returned, make changes as necessary.
            $('.read-clipped a').text(settings.readLessText).appendTo($(this).parent('p'));
    
            //display the rest of the text        
            $('.read-hidden').css('display', 'inline');
            $('.read-hidden').animate({
              opacity:1
            }, 500); 
              //element is shown already, replace the text on next click.  
          }else if($('.read-hidden').css('display') == 'inline'){
            $('.read-hidden').animate({
              opacity:0  
            }, 500, function(){
              $('.read-hidden').css('display', 'none');
              $this.html(clippedText);      
            });
           }
         });
       });
      }
    })(jQuery);
    

    Invoking the plugin is fairly straight forward ->

    $('#element').clipped({ 
      // clip text at
      'start': 0, 
      //end clipped text at
      'end': 255, 
      //display the rest of the text starting from
      'showFrom': 255, 
      //Read More Text
      'readMoreText' : 'Read More Stuff',
      //Read Less Text 
      'readLessText' : 'Read Less Stuff'
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a website and having some problem. if the HTML code is like:
The website that I'm currently working on is having a few issues with Webkit
I'm writing a mobile website and I would like the user to be able
I'm having trouble with caching on my website. I have static files that should
Like several other people, I'm having problems serializing Entity Framework objects, so that I
I am updating a website for a radio station and they would like to
I am having a website which stores some message in arabic .When i try
I created a ASP.NET3.5 website having a crystalreportviewer in it, it works fine if
I have a weird situation. A client of mine has a website having this
I'm having a problem concerning my website not running the code behind an ItemCommand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.