Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding "More" text after ellipsis, inline #31

Open
schalkjoubert opened this issue Feb 11, 2016 · 4 comments
Open

Adding "More" text after ellipsis, inline #31

schalkjoubert opened this issue Feb 11, 2016 · 4 comments

Comments

@schalkjoubert
Copy link

Hi, Thank you so much for this, exactly what I was looking for!
One change I hope to make though. I would like to place the "more" link next to the ellipses, inline.

So it reads:
co-founder of an events management ... more

Can you put me in the right direction, please.

@eagleyed
Copy link

I was trying to do the same thing but I couldn't make it. Please help us

@alvintodoteasy
Copy link

You can use the code (http://pastebin.com/ARTYQUuc), which was built on top of Pablo Pazos by gi. The link was found in the comment section of http://viralpatel.net/blogs/dynamically-shortened-text-show-more-link-jquery/

However, you do need to add $(‘.morelink’).die(); before $(‘.morelink’).live(‘click’, function(){ …..
as stated by Yasir.

@Cauldrath
Copy link

I made a version with some alterations to include an option inlineMore, which, if set to true, will put the more and less links inside the same container as the shortened and all text:
https://github.com/Cauldrath/jquery.shorten/blob/inlineMore/src/jquery.shorten.js

I also removed some commented-out console.logs and trim the incoming text and html so that preceeding whitespace won't affect the letter count. Those changes should be easy enough to remove if you don't want them.

I'm not making a PR at this time because it does make the code a lot more complicated.

@GarageWeb
Copy link

In the inline version, there is a bug. The else of this section " if (c.indexOf('<') >= 0)" does not add the read more link. So, if it cuts on something not on the open tag etc, you get nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants