Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Collapse and expand plugin for bootstrap

I been using bootstrap collapse in my site.

is there any jquery that i can use in my bootstrap site that will work like this.

example

i have a comment section. sample comment would be like this.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sit amet suscipit magna. Sed nisl ipsum, tempus quis tincidunt non, molestie eget tortor. Sed scelerisque magna arcu, non hendrerit lorem vehicula ut. Vestibulum vulputate erat non mauris vulputate condimentum. Nam adipiscing nec risus at condimentum. Nulla sed lorem lacus. Proin bibendum, diam non faucibus fringilla, diam leo scelerisque nisl, sed tempor velit diam eu turpis. Aenean lacinia auctor tellus non tincidunt. Vivamus condimentum sem lacus. Donec vehicula eros erat, eu scelerisque urna varius eu. Phasellus lobortis dignissim dolor euismod pharetra. Morbi sodales posuere nisi sodales adipiscing. Vestibulum nec tortor vitae diam pharetra pretium sed eget arcu. Vestibulum ultricies rutrum risus. Cras rhoncus magna eget viverra dignissim. Integer et justo lacus.

i want to make it something like this..that on every 5th of the line it will be change it to see more like the one on facebook.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sit amet suscipit magna. Sed nisl ipsum, tempus quis tincidunt non, molestie eget tortor. Sed scelerisque magna arcu, non hendrerit lorem vehicula ut. Vestibulum vulputate erat non mauris vulputate condimentum. Nam adipiscing nec risus at condimentum. Nulla sed lorem

See more...

i tried using collapse in bootstrap collapse but it collapse all part of the message.

like image 535
user2095165 Avatar asked Jan 24 '14 07:01

user2095165


People also ask

How do you expand and collapse in Bootstrap?

Just add data-toggle="collapse" and a data-target to the element to automatically assign control of one or more collapsible elements. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element.

What is Bootstrap collapse plugin?

The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height from its current value to 0 . Given how CSS handles animations, you cannot use padding on a . collapse element.

What is the jquery code for collapsible content?

Basic collapsible To create a collapsible block of content, create a container and add the data-role="collapsible" attribute. Directly inside this container, add any header (H1-H6) or legend element.

What collapse plugin provides?

The collapse plugin utilizes a few classes to handle the heavy lifting: .collapse hides the content. .collapse.show shows the content. .collapsing is added when the transition starts, and removed when it finishes.


1 Answers

You can use the jTruncate jQuery plugin.

In a nutshell, jTruncate provides simple yet customizable truncation for text entities in your web page.

Code:

$().ready(function () {
    $('p').jTruncate({
        moreText: "See more..."
    });
});

Demo: http://jsfiddle.net/IrvinDominin/wFTLj/

like image 78
Irvin Dominin Avatar answered Sep 20 '22 00:09

Irvin Dominin