「MediaWiki:Mobile.js」の版間の差分
提供:パルワールド 攻略Wiki
(ページの作成:「→ここにある全てのJavaScriptはモバイル版サイトの利用者に影響します: mw.loader.load('https://js.boost-next.co.jp/t/056/267/a100056267.js');」) タグ: モバイル編集 モバイルウェブ編集 |
編集の要約なし タグ: 手動差し戻し |
||
(同じ利用者による、間の30版が非表示) | |||
1行目: | 1行目: | ||
/ | //トップに戻るボタン | ||
$(document).ready(function() { | |||
var backToTopButton = $('<div/>', { | |||
id: 'back-to-top', | |||
html: '<i class="fa-solid fa-chevron-up"></i>', | |||
click: function() { | |||
window.scrollTo(0, 0); | |||
} | |||
}).appendTo('body'); | |||
backToTopButton.show(); | |||
var inactivityTimer; | |||
function resetInactivityTimer() { | |||
backToTopButton.show(); | |||
clearTimeout(inactivityTimer); | |||
inactivityTimer = setTimeout(function() { | |||
backToTopButton.fadeOut(); | |||
}, 2000); | |||
} | |||
$(window).scroll(resetInactivityTimer); | |||
$(window).mousemove(resetInactivityTimer); | |||
resetInactivityTimer(); | |||
}); | |||
// bgwrapper | |||
document.addEventListener('DOMContentLoaded', function() { | |||
// 目的の要素を選択します。 | |||
var targetElement = document.querySelector('.pre-content.heading-holder'); | |||
// 目的の要素が存在する場合にのみ処理を進めます。 | |||
if (targetElement) { | |||
// 新しい div 要素を作成します。 | |||
var newDiv = document.createElement('div'); | |||
newDiv.className = 'bgwrapper'; | |||
// この新しい div を目的の要素の後に挿入します。 | |||
targetElement.parentNode.insertBefore(newDiv, targetElement.nextSibling); | |||
} | |||
}); |
2024年1月17日 (水) 02:29時点における最新版
//トップに戻るボタン
$(document).ready(function() {
var backToTopButton = $('<div/>', {
id: 'back-to-top',
html: '<i class="fa-solid fa-chevron-up"></i>',
click: function() {
window.scrollTo(0, 0);
}
}).appendTo('body');
backToTopButton.show();
var inactivityTimer;
function resetInactivityTimer() {
backToTopButton.show();
clearTimeout(inactivityTimer);
inactivityTimer = setTimeout(function() {
backToTopButton.fadeOut();
}, 2000);
}
$(window).scroll(resetInactivityTimer);
$(window).mousemove(resetInactivityTimer);
resetInactivityTimer();
});
// bgwrapper
document.addEventListener('DOMContentLoaded', function() {
// 目的の要素を選択します。
var targetElement = document.querySelector('.pre-content.heading-holder');
// 目的の要素が存在する場合にのみ処理を進めます。
if (targetElement) {
// 新しい div 要素を作成します。
var newDiv = document.createElement('div');
newDiv.className = 'bgwrapper';
// この新しい div を目的の要素の後に挿入します。
targetElement.parentNode.insertBefore(newDiv, targetElement.nextSibling);
}
});