Apps whose displays tend to jump raggedly during animations, scrolling, or other user interaction suffer from a performance issue commonly called jank or judder. Jank is an annoying distraction for users; it interrupts the users' flow of thought and it makes the app look less polished and professional.
This file contains 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
function request(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = 'json'; | |
xhr.onload = callback; | |
xhr.send(); | |
} | |
// demo |
This file contains 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
// Check | |
$(':checkbox').prop('checked', true); | |
// Un-check | |
$(':checkbox').prop('checked', false); | |
// Toggle | |
$(':checkbox').prop('checked', function (i, value) { | |
return !value; | |
}); |
This file contains 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
<!-- add a perfect pixel layer [[ --> | |
<div class="perfect-pixel" style="display:none;position: absolute; z-index: 2147483646; width: 100%; height: auto; cursor: all-scroll; pointer-events: none; margin: 0 auto; margin-left: -50%; top: 0; left: 50%; min-width: 1190px; opacity: 0.3; background-color: transparent;"> | |
<img src="temp/index-1190x.jpg" alt="" style="position: relative; margin: 0 auto; padding: 0px; display: block; height: auto;"> | |
</div> | |
<!-- add a perfect pixel layer ]] --> |
This file contains 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{ | |
color:red; /* All browsers */ | |
color:red !important;/* All browsers but IE6 */ | |
_color:red; /* Only works in IE6 */ | |
*color:red; /* IE6, IE7 */ | |
+color:red;/* Only works in IE7*/ | |
*+color:red; /* Only works in IE7 */ | |
color:red\9; /* IE6, IE7, IE8, IE9 */ | |
color:red\0; /* IE8, IE9 */ | |
color:red\9\0;/*Only works in IE9*/ |
This file contains 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
function leftpad (str, len, ch) { | |
str = String(str); | |
var i = -1; | |
if (!ch && ch !== 0) ch = ' '; | |
len = len - str.length; | |
while (++i < len) { |
This file contains 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
c:>netstat -ano|findstr "8080" | |
c:>tasklist|findstr 3112 |
This file contains 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
div { | |
width: 300px; | |
overflow: hidden; | |
white-space: nowrap; | |
-ms-text-overflow: ellipsis; | |
text-overflow: ellipsis; | |
} |
This file contains 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 supportPlaceHolder = function() { | |
// first, detect the placeholder attribute | |
var isPlaceholder = function(){ | |
var input = document.createElement('input'); | |
return 'placeholder' in input; | |
} | |
if(!isPlaceholder()){ | |
$('[placeholder]').each(function(){ | |
var defaultValue = $(this).attr("placeholder"); |
This file contains 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
// UC-U3内核JavaScript专用API | |
// (经测试,官方文档给出的API很多也不能使用,下面只列出测试能用的) | |
// 1. 关闭默认手势 | |
// 用法: | |
navigator.control.gesture(false); | |
// 推荐写法: | |
try { | |
navigator.control.gesture(false); | |
} catch (e) { | |
} |