Reputation:
I've been trying to use jquery's dotdotdot method in order to cut off overflowed text, but for some reason it's not working. I was hoping the method would be pretty simple, but I don't know what I'm doing wrong.
Javascript:
$(document).ready(function(){
$('.dotdotdot').dotdotdot({
ellipsis: '... ',
wrap: 'word',
after: null,
watch: true,
height: 40
});
});
html:
<div class="dotdotdot">
<?php echo $description; /*Current div height with text exceeds 40px*/ ?>
</div>
I cant find anything that would explain why this isn't working. My jquery is up to date, version 1.8.3.
Upvotes: 3
Views: 5526
Reputation: 20364
Depending on your needs, you could just use the text overflow property ellipses
See this website for more details, and an example.
http://www.quirksmode.org/css/user-interface/textoverflow.html
Upvotes: 1
Reputation: 111
dotdotdot is a jQuery plugin which you need to download separately and include that JS also then it should work. Refer to http://dotdotdot.frebsite.nl/ for more details.
Upvotes: 3