“MediaWiki:Common.js”的版本间的差异
跳到导航
跳到搜索
| 第28行: | 第28行: | ||
$(document).ready(function(){ | |||
//首先将#back-to-top隐藏 | |||
$("#back-to-top").hide(); | |||
//当滚动条的位置处于距顶部600像素以下时,跳转链接出现,否则消失 | |||
$(function () { | |||
$(window).scroll(function(){ | |||
if ($(window).scrollTop()>600){ | |||
$("#back-to-top").fadeIn(500); | |||
}else{ | |||
$("#back-to-top").fadeOut(500); | |||
} | |||
}); | |||
//当点击跳转链接后,回到页面顶部位置 | |||
$("#back-to-top").click(function(){ | |||
$('body,html').animate({scrollTop:0},500); | |||
return false; | |||
}); | |||
}); | |||
}); | |||
2021年11月24日 (三) 21:20的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
$(self.document).ready(function () {
function Event_Break() { return false; }
$(
'button, .No_Select'
).attr('unSelectable', 'on').css({
'-moz-user-select': '-moz-none',
'-khtml-user-select': 'none',
'-webkit-user-select': 'none',
'-o-user-select': 'none',
'-ms-user-select': 'none',
'user-select': 'none',
'-webkit-touch-callout': 'none'
}).bind('selectStart', Event_Break).bind('contextmenu', Event_Break);
});
// 官方文档:添加MediaWiki:Common.js:
function waitForMathJax($content) {
if (typeof MathJax === 'undefined') {
setTimeout(function () { waitForMathJax($content); }, 1000);
} else {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
}
}
mw.hook('wikipage.content').add(waitForMathJax);
$(document).ready(function(){
//首先将#back-to-top隐藏
$("#back-to-top").hide();
//当滚动条的位置处于距顶部600像素以下时,跳转链接出现,否则消失
$(function () {
$(window).scroll(function(){
if ($(window).scrollTop()>600){
$("#back-to-top").fadeIn(500);
}else{
$("#back-to-top").fadeOut(500);
}
});
//当点击跳转链接后,回到页面顶部位置
$("#back-to-top").click(function(){
$('body,html').animate({scrollTop:0},500);
return false;
});
});
});