MediaWiki:Common.js:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
| 第3行: | 第3行: | ||
/* TAB卡 */ | /* TAB卡 */ | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
window.onload = function() { | |||
var oDiv = document.getElementById("tab"); | |||
var oLi = oDiv.getElementsByTagName("div")[0].getElementsByTagName("li"); | |||
var aCon = oDiv.getElementsByTagName("div")[1].getElementsByTagName("div"); | |||
var timer = null; | |||
for (var i = 0; i < oLi.length; i++) { | |||
oLi[i].index = i; | |||
oLi[i].onmouseover = function() { | |||
show(this.index); | |||
} | |||
} | |||
function show(a) { | |||
index = a; | |||
var alpha = 0; | |||
for (var j = 0; j < oLi.length; j++) { | |||
oLi[j].className = ""; | |||
aCon[j].className = ""; | |||
aCon[j].style.opacity = 0; | |||
aCon[j].style.filter = "alpha(opacity=0)"; | |||
} | |||
oLi[index].className = "cur"; | |||
clearInterval(timer); | |||
timer = setInterval(function() { | |||
alpha += 2; | |||
alpha > 100 && (alpha = 100); | |||
aCon[index].style.opacity = alpha / 100; | |||
aCon[index].style.filter = "alpha(opacity=" + alpha + ")"; | |||
alpha == 100 && clearInterval(timer); | |||
}, | |||
5) | |||
} | |||
} | |||
</script> | </script> | ||
/* TAB卡-END */ | /* TAB卡-END */ | ||
2016年2月26日 (五) 21:17的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
/* TAB卡 */
<script type="text/javascript">
window.onload = function() {
var oDiv = document.getElementById("tab");
var oLi = oDiv.getElementsByTagName("div")[0].getElementsByTagName("li");
var aCon = oDiv.getElementsByTagName("div")[1].getElementsByTagName("div");
var timer = null;
for (var i = 0; i < oLi.length; i++) {
oLi[i].index = i;
oLi[i].onmouseover = function() {
show(this.index);
}
}
function show(a) {
index = a;
var alpha = 0;
for (var j = 0; j < oLi.length; j++) {
oLi[j].className = "";
aCon[j].className = "";
aCon[j].style.opacity = 0;
aCon[j].style.filter = "alpha(opacity=0)";
}
oLi[index].className = "cur";
clearInterval(timer);
timer = setInterval(function() {
alpha += 2;
alpha > 100 && (alpha = 100);
aCon[index].style.opacity = alpha / 100;
aCon[index].style.filter = "alpha(opacity=" + alpha + ")";
alpha == 100 && clearInterval(timer);
},
5)
}
}
</script>
/* TAB卡-END */