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 b = '{comment}'.replace((new RegExp('({comment})','g')), '$123'); | |
| console.log(b); //{comment}23 | |
| var b = '{comment}'.replace((new RegExp('{comment}','g')), '$123'); | |
| console.log(b); //$123 |
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
| <ul class='thumbnails'> | |
| <li> | |
| <a class='thumbnail'> | |
| <img src='http://ww1.sinaimg.cn/mw690/a1d3feabjw1e57a6ito1gj205a02sq37.jpg' /> | |
| </a> | |
| </li> | |
| </ul> |
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 a = 1; | |
| (function () { | |
| var a = 3; | |
| (new Function('console.log(a)'))(); // 1 | |
| })(); |
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{ | |
| -webkit-line-clamp: 4; | |
| -webkit-box-orient: vertical; | |
| display: -webkit-box; | |
| } |
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
| this.context = [].concat.apply([], selector); | |
| //selector是个伪数组(元素列表),这样转换成数组不可靠,三星大部分机器会报错。 |
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
| // 判断是否为移动端运行环境 | |
| if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD| | |
| DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia | |
| |SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) { | |
| if (window.location.href.indexOf("?mobile") < 0) { | |
| try { | |
| if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { |
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
| <p class="title"> | |
| <b></b> | |
| <span>科鲁兹人气榜</span> | |
| </p> |
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(.*)z/.exec('aszdfffz'); | |
| //禁止贪婪模式 | |
| a(.*?)z/.exec('aszdfffz'); |
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
| /* | |
| *元素渐变显示 | |
| */ | |
| .banner_item{ | |
| display: inline-block; | |
| background-size: 100%; | |
| width: 814px; | |
| height: 316px; | |
| overflow: hidden; | |
| background-repeat: no-repeat; |
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 arr = [1, 2, 3, 4, 5]; | |
| arr.sort(function (a, b) { | |
| return Math.random()>.5 ? -1 : 1;//用Math.random()函数生成0~1之间的随机数与0.5比较,返回-1或1 | |
| }); |