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

Dynamic width #7

Open
ghost opened this issue Oct 10, 2011 · 2 comments
Open

Dynamic width #7

ghost opened this issue Oct 10, 2011 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 10, 2011

I like this plugin, but the main issue I have is that I'm not able to use this on dynamic divs.
For example, when you want to use this for a mobile website and the user rotates the screen you gain more space, but this plugin is not able to be dynamic.

@fgarci03
Copy link

fgarci03 commented May 4, 2015

Same happens on resize (both ways). I also tested something like:

$('.class').truncate();
$( window ).resize(function() {
  $('.class').truncate();
});

but it:

  • *has a huge lag (I know this wouldn't be an actual solution, but was testing);
  • it solves resizing to a smaller window, but not to a bigger window, as @ghost stated.

*The lag is also present in the begining, when the page loads. It loads without truncating and then updates the DOM. I'm testing it in an AngularJS app, so maybe I'm doing something wrong too

@croucha
Copy link

croucha commented Sep 4, 2015

I have experienced the lag too. It was in a situation where I was trying to truncate over 100 texts. The lag is definitely caused by the hidden span tag (worker), which is used to properly calculate the actual width being taken up by the text. Unfortunately, I don't think there's any other way around this in order to get the actual width the text takes up inside of an element... Unless multi threading exists in JavaScript, lol!

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

2 participants