超出文字省略号显示
css方法:
overflow:hidden; white-space:nowrap; text-overflow:ellipsis;js方法:
function Ellipsis() {$(".overflowHidden").each(function(){maxwidth=$(this).attr("data-max");if($(this).text().length>maxwidth){$(this).text($(this).text().substring(0,maxwidth));$(this).html($(this).html()+'...');}else{$(this).text($(this).text());}}); }html頁面中使用的時候:
<div class="overflowHidden" data-max="10" >
</div>
<script>
Ellipsis();
//調用函數;
</script>
?
轉載于:https://www.cnblogs.com/wenrain/p/4679889.html
總結
- 上一篇: 查看eclipse安装了哪些插件
- 下一篇: [android] AndroidMan