rviscomi / trunk8

jQuery Truncation Plugin -- THIS PROJECT IS NO LONGER MAINTAINED

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Truncates all characters

s1h4d0w opened this issue · comments

Problem and fix:

I applied the trunk8 class to a td element which seemed to cause problems. After putting my text in a span and applying the trunk8 class to that element it worked without problems.


Original message:

I am using Trunk8 for a website where it needs to truncate names in a table cell. When the website is viewed on mobile some non-essential things get trucated.

Yesterday on my Mac on Firefox 37.0.2 it worked without a problem, but after checking today on my Windows machine the text does not show up at all. This is on Firefox 37.0.2 and Chrome 42.0.2311.135. The complete text is in the "title" tag of the table-cell with the truncate class. If I press Ctrl + F5 it works correctly, but if I then just press F5 or close and reopen the page the text is gone again.

I have included jQuery 1.7 in my head and have called $(".truncate").trunk8(); below that.

On pageload:
On pageload

After pressing Ctrl + F5:
After pressing Ctrl + F5

Do you have a link to view the markup? (even if it's just a simple jsfiddle example that shows your problem, that would be fine)

Also, just a tip that you shouldn't need to load jQuery and trunk8 in the document head. You should be able to load these scripts at the end of the document, just before the closing body tag. I don't think it's causing the problem you're describing, but it helps page load performance.

Hi Rick,

Thank you for contacting me, much appreciated. I’ve tried using Trunk8 in a jsFiddle bit it appeared to be working fine.

As the project is in a very early stage I have no problem giving you some login credentials, the site is in Dutch but I can point you around:

Visit: http://www.nickbetting.nl/yd/

Username:
Password:
Wekelijkse toegangscode:

After you’ve been logged in click the “ga naar beheerpaneel” link just below the logo. Now you can click either “Locaties” or “Medewerkers” to view where it’s going wrong. I’m using Windows 8.1 with Firefox 37.0.2, Chrome 42.0.2311.135 m, Internet Explorer 11 and Opera 29 and it works on none of those. If I log in with my iPhone under Safari it works without a problem.

Thank you so much for the help!

Kind regards,

Nick Betting

It seems to be working for me on Chrome Mac, but one thing I noticed is that your trunk8 class is on a td element. Try structuring your markup like this instead:

<td><span class="trunk8">text</span></td>

I think the default styles on the td may be interfering with the way the text gets rendered.

Let me know if that helps.

Hi Rick,

That fixed it, thanks a bunch. I assumed it would work on any element, I saw some reported issues on other elements but didn't see any for td's. By putting the text in a separate span it worked flawlessly.

Thanks and keep up the good work!