Blogger Ever

How to make the text shorter for home page in blog post?

Making of text shorter or to minimize sometimes becomes necessary to get a better design.I'm going to share how to make it shorter using Jquery and Javascript,but you must know the basic of Jquery to work with it so lets start with it.
For instance your post is having structure something like this one
<div class='post'>
  Ea eam labores imperdiet, apeirian democritum ei nam, doming neglegentur ad vis. Ne malorum ceteros feugait quo, ius ea liber offendit placerat, est habemus aliquyam legendos id. Eam no corpora maluisset definitiones, eam mucius malorum id. Quo ea idque commodo utroque, per ex eros etiam accumsan.
Eu mei solum oporteat eleifend, libris nominavi maiestatis duo at, quod dissentiet vel te. Legere prompta impedit id eum. Te soleat vocibus luptatum sed, augue dicta populo est ad, et consul diceret officiis duo. Et duo primis nostrum.
So to make it short a we use .substr function which extract a particular part of a text.So we do something like this one.
  var text=$(this).text();
  var count=100;
    var cut=text.substr(0,count);
    var cut=text;
Now the result will be 
See the Pen Shorter the text by Mohammad Hamza Dhamiya (@mohammadhamza) on CodePen
Want to ask something? We are waiting for comments.


2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.