This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
hack IE6 IE7 FF IE8~IE10 | |
——————————————————————————————————————————————————————————————— | |
* √ √ × × | |
——————————————————————————————————————————————————————————————— | |
!important × √ √ √ | |
——————————————————————————————————————————————————————————————— | |
_ √ × × × |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/[^a-zA-Z0-9\u4e00-\u9fa5]/g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text { | |
/*也可为 max-width*/ | |
width:100px; | |
white-space:nowrap; /*不换行*/ | |
overflow:hidden; | |
text-overflow:ellipsis; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CSS设置不转行CSS属性标签: | |
overflow:hidden 隐藏——css 隐藏 | |
white-space:normal 默认 | |
pre 换行和其他空白字符都将受到保护 | |
nowrap 强制在同一行内显示所有文本,直到文本结束或者遭遇 br 对象 | |
设置强行换行CSS属性标签 | |
word-break: | |
normal ; 依照亚洲语言和非亚洲语言的文本规则,允许在字内换行 | |
break-all : 该行为与亚洲语言的normal相同。也允许非亚洲语言文本行的任意字内断开。该值适合包含一些非亚洲文本的亚洲文本 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lengthOf = function (str) { | |
return str.replace(/[^\x00-\xFF]/g,'**').length; | |
}; | |
// or 'keyup' | |
var onChange = function () { | |
var val = $(this).val(), len = 40, i=20; | |
if (lengthOf(val) > len) { | |
while (lengthOf(val.substring(0, i)) < len) { | |
i++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var typeOf = function (arg) { | |
return Object.prototype.toString.call(undefined).slice(8,-1) | |
.toLowerCase(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var onchangeHandler = function () { //限制只能输入数字 | |
var val = this.getValue(), | |
keyVal = val && val.charAt(val.length - 1); | |
if (!keyVal) { | |
return; | |
} | |
if (!/\d{1}/.test(keyVal)) { | |
while (val && isNaN(val = val.slice(0,-1)) ) { |