我一直試圖使用jquery的dotdotdot方法來切斷溢出的文本,但由於某種原因,它不工作。我希望這種方法很簡單,但我不知道我做錯了什麼。jquery .dotdotdot無法正常工作
的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>
我找不到任何可以解釋爲什麼這是行不通的。我的jquery是最新版本1.8.3。
這不是一個標準的jQuery函數。你有沒有提供它的插件? – JJJ 2013-04-29 17:22:20
此外,jQuery 1.8.3不再是「最新」的。 – JJJ 2013-04-29 17:25:23
@Juhana什麼是最新版本? – Alex 2013-04-29 17:35:24