MediaWiki:Mobile.js:修订间差异
跳转到导航
跳转到搜索
(创建页面,内容为“→这里的任何JavaScript将为使用移动版网站的用户加载: $(function () { →模板:战舰少女R导航: $(".banner1").hover(functio...”) |
无编辑摘要 |
||
第1行: | 第1行: | ||
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */ | /* 这里的任何JavaScript将为使用移动版网站的用户加载 */ | ||
$(function () { | $(function () { | ||
/* | /*战舰少女R导航*/ | ||
$(".banner1").hover(function () { | (function ($, de) { | ||
/*导航栏悬浮、点击展开*/ | |||
$(".banner1").hover(function () { | |||
$(this).find(".banner2").eq(0).show(); | |||
}, function () { | |||
$(this).find(".banner2").eq(0).hide(); | |||
}); | |||
var isTouch = ('ontouchstart' in de) ? 'touchstart' : 'click', _on = $.fn.on; | |||
$.fn.on = function () { | |||
arguments[0] = (arguments[0] === 'click') ? isTouch : arguments[0]; | |||
return _on.apply(this, arguments); | |||
}; | |||
$(".banner1").on("click", function () { | |||
obj.hide(); | var obj = $(this).find(".banner2").eq(0); | ||
} | if (obj.is("visible")) { | ||
obj.hide(); | |||
} else { | |||
obj.show(); | |||
} | |||
$(this).siblings().find(".banner2").hide(); | |||
}); | |||
/*导航栏倒计时*/ | |||
var now = new Date(); | |||
var nows = now.getTime(); | |||
now.setHours(0); | |||
now.setMinutes(0); | |||
now.setSeconds(0); | |||
var today = now.getTime(); | |||
var passed = Math.floor((nows - today) / 1000); | |||
changeCountDown(); | |||
setInterval(function () { | |||
changeCountDown(); | |||
}, 1000); | |||
function changeCountDown() { | |||
var lave = 24 * 60 * 60 - passed,h = Math.floor(lave / 3600), m = Math.floor((lave - h * 3600) / 60), s = lave - h * 3600 - m * 60,_s='',_c='#0F3'; | |||
if(passed<60) _s=",成功+1day"; | |||
if(passed>12*3600) _c="#fc0"; | |||
if(passed>23*3600) _c="#F30"; | |||
$("#zjsnr-lavetime").html("<span style='color:"+_c+"'>"+h+"</span>"+"小时" +"<span style='color:"+_c+"'>"+m+"</span>" + "分" + "<span style='color:"+_c+"'>"+s+"</span>" + "秒"+_s); | |||
passed++; | |||
} | } | ||
}(jQuery, document.documentElement)); | |||
}) | }) |
2016年5月24日 (二) 18:28的版本
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */
$(function () {
/*战舰少女R导航*/
(function ($, de) {
/*导航栏悬浮、点击展开*/
$(".banner1").hover(function () {
$(this).find(".banner2").eq(0).show();
}, function () {
$(this).find(".banner2").eq(0).hide();
});
var isTouch = ('ontouchstart' in de) ? 'touchstart' : 'click', _on = $.fn.on;
$.fn.on = function () {
arguments[0] = (arguments[0] === 'click') ? isTouch : arguments[0];
return _on.apply(this, arguments);
};
$(".banner1").on("click", function () {
var obj = $(this).find(".banner2").eq(0);
if (obj.is("visible")) {
obj.hide();
} else {
obj.show();
}
$(this).siblings().find(".banner2").hide();
});
/*导航栏倒计时*/
var now = new Date();
var nows = now.getTime();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
var today = now.getTime();
var passed = Math.floor((nows - today) / 1000);
changeCountDown();
setInterval(function () {
changeCountDown();
}, 1000);
function changeCountDown() {
var lave = 24 * 60 * 60 - passed,h = Math.floor(lave / 3600), m = Math.floor((lave - h * 3600) / 60), s = lave - h * 3600 - m * 60,_s='',_c='#0F3';
if(passed<60) _s=",成功+1day";
if(passed>12*3600) _c="#fc0";
if(passed>23*3600) _c="#F30";
$("#zjsnr-lavetime").html("<span style='color:"+_c+"'>"+h+"</span>"+"小时" +"<span style='color:"+_c+"'>"+m+"</span>" + "分" + "<span style='color:"+_c+"'>"+s+"</span>" + "秒"+_s);
passed++;
}
}(jQuery, document.documentElement));
})