2015-12-04

一个版本比较的方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function versionCompare(versionA, versionB) {
  var versionAList = versionA.split('.');
  var versionBList = versionB.split('.');
  var maxLen = Math.max( versionAList.length, versionBList.length );

  var result, a, b;
  for (var i = 0; i < maxLen; i++) {

    a = ~~versionAList[i];
    b = ~~versionBList[i];

    if(a > b) result = 1;
    else if (a < b) result = -1;
    else result = 0;

    if (result !== 0) return result;
  }
  return result;
}

palceholder color

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
::-webkit-input-placeholder {
  color: red;
}

:-moz-placeholder { /* Firefox 18- */
  color: red;
}

::-moz-placeholder {  /* Firefox 19+ */
  color: red;
}

:-ms-input-placeholder {
  color: red;
}

分享一个图片上的 移动端图片格式调研

Comments