「MediaWiki:Mobile.js」の版間の差分
提供:パルワールド 攻略Wiki
編集の要約なし タグ: 差し戻し済み モバイル編集 モバイルウェブ編集 |
編集の要約なし タグ: 差し戻し済み モバイル編集 モバイルウェブ編集 |
||
29行目: | 29行目: | ||
document.addEventListener("DOMContentLoaded", function() { | document.addEventListener("DOMContentLoaded", function() { | ||
// 'pre-content heading-holder'クラスを持つ最初の要素を見つける | // 'pre-content heading-holder'クラスを持つ最初の要素を見つける | ||
var targetElement = document.querySelector('.pre-content | var targetElement = document.querySelector('.pre-content'); | ||
// 新しいdiv要素を作成 | // 新しいdiv要素を作成 |
2024年1月16日 (火) 01:28時点における版
//トップに戻るボタン
$(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() {
// 'pre-content heading-holder'クラスを持つ最初の要素を見つける
var targetElement = document.querySelector('.pre-content');
// 新しいdiv要素を作成
var newDiv = document.createElement('div');
newDiv.className = 'bgwrapper';
// targetElementの直後に新しいdivを挿入
targetElement.parentNode.insertBefore(newDiv, targetElement.nextSibling);
});