JSFiddle - React, Tailwind, and code Playground
HTML
<body onload="_l='t';">
<a href="#" id="a">一个好汉三个帮</a>
<p>(请用火狐浏览器观看这个演示,目前只有火狐浏览器实现了对它的支持)</p>
<script>
document.getElementById('a').onclick = function (e) {
e.preventDefault();
};
</script>
<script>
(function() {
setTimeout(function() {
// If onload hasn't been called, stop all requests after 2 seconds
if(typeof(_l) == 'undefined') {
if(window.stop !== undefined) window.stop();
else if(document.execCommand !== undefined) document.execCommand("Stop", false);
}
}, 2000, 'push');
/*
* Capture and kill CSS animations after X number of seconds
*/
function pauseAnimations() {
var body = document.getElementsByTagName('body')[0];
if(body.addEventListener) {
body.addEventListener("webkitAnimationStart", listener, false);
body.addEventListener("webkitAnimationIteration", listener, false);
body.addEventListener("animationstart", listener, false);
body.addEventListener("animationiteration", listener, false);
}
}
function listener(e) {
if(e.type == "webkitAnimationStart" || e.type == "webkitAnimationIteration") {
var targetEl = e.target;
setTimeout(function() {
targetEl.style.webkitAnimationPlayState = 'paused';
}, __animationDuration, 'push');
}
else if(e.type == "animationstart" || e.type == "animationiteration") {
var targetEl = e.target;
setTimeout(function() {
targetEl.style.MozAnimationPlayState = 'paused';
}, __animationDuration, 'push');
}
}
pauseAnimations();
// Pause all audio elements, allow the audio/video
// elements to render before stopping them
function pauseElementTypes(type) {
for (var i = 0, els = document.getElementsByTagName(type); i < els.length; i++) {
els[i].pause();
}
}
// Wait until the elements have been created to pause them
setTimeout(function() {
...
CSS
body {
padding: 30px;
text-align: center;
font-family: Arial, sans-serif;
}
a, a:visited {
color: blue;
background: aqua;
-moz-text-decoration-color: aqua;
-moz-text-decoration-line: overline;
-moz-text-decoration-style: wavy;
text-decoration-color: aqua;
text-decoration-line: overline;
text-decoration-style: wavy;
}