function ctrlSign() {
// *= 所选元素
$('*').each(
function(){
var _this = $(this);
var txt = _this.text(),
w = _this.width(),
fs =parseInt(_this.css('fontSize'));
n = parseInt(w/fs)*2 - 1;
if(txt.length >= n){
ntxt = txt.slice(0,n);
_this.text(ntxt+'...');
}
})
};
网友评论