GithubHelp home page GithubHelp logo

Comments (8)

kswedberg avatar kswedberg commented on August 21, 2024

It doesn't break the string because it's also looking at the widow option's value. If you set that to 0 it should work.

$('#myws').expander({widow: 0});

Does that work for you? If so, feel free to close this issue. Thanks!

from jquery-expander.

iwasrobbed avatar iwasrobbed commented on August 21, 2024

Thanks for the quick reply!

If I set widow to 0 then it places the "Read more" link next to every description, even if it doesn't meet the slice character requirement. I'm using the class name expandable, so for every element that has the expandable class it now has that link next to it even if it's only a few characters long.

from jquery-expander.

kswedberg avatar kswedberg commented on August 21, 2024

Hi Rob, Sorry for the delay. I was on vacation until late last night. I'll try to take another look at this asap. Feel free to ping me if you don't hear from me again soon.

from jquery-expander.

iwasrobbed avatar iwasrobbed commented on August 21, 2024

No rush, Karl! I just wanted to file it as an issue (and a rare one at that) while it was still on my mind

from jquery-expander.

kswedberg avatar kswedberg commented on August 21, 2024

Funny, I should be more familiar with my own plugin. Try it this way:

$('#myws').expander({widow: 0, preserveWords: false});

from jquery-expander.

iwasrobbed avatar iwasrobbed commented on August 21, 2024

Now it works for that edge case, but it shows "Read more" next to all strings even if they don't meet the slice requirement:

    $('.expandable').expander({
      slicePoint: 300,
      expandPrefix: '... ',
      expandText: 'Read more',
      preserveWords: false,
      userCollapse: false,
      widow: 0
    });

Gives:

 Music video by Ellie Goulding performing Lights. (C) 2011 Polydor Ltd. (UK)... Read more

Even though that string is less than 300 characters (so it shouldn't be showing Read more for it).

from jquery-expander.

kswedberg avatar kswedberg commented on August 21, 2024

thx again! it actually revealed an unrelated bug, which I just fixed in the latest commit.

from jquery-expander.

iwasrobbed avatar iwasrobbed commented on August 21, 2024

Works like a charm, thank YOU Karl!!!

from jquery-expander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.