「MediaWiki:Mobile.js」の版間の差分
ナビゲーションに移動
検索に移動
Karanemi666 (トーク | 投稿記録) (ページの作成:「→ここにある全てのJavaScriptはモバイル版サイトの利用者に影響します: $(function() { $('section.collapsible-block').each(function() { var $section = $(this); if (!$section.hasClass('mw-collapsible')) { $section.addClass('mw-collapsible mw-collapsed'); $section.wrapInner('<div class="mw-collapsible-content"></div>'); // 直前の見出しクリックで開閉 var $heading…」) |
Karanemi666 (トーク | 投稿記録) 編集の要約なし タグ: モバイル編集 モバイルウェブ編集 |
||
1行目: | 1行目: | ||
/* ここにある全てのJavaScriptはモバイル版サイトの利用者に影響します */ | /* ここにある全てのJavaScriptはモバイル版サイトの利用者に影響します */ | ||
mw.hook('mobileFrontend.content').add(function($content) { | |||
$('section.collapsible-block').each(function() { | $content.find('section.collapsible-block').each(function() { | ||
var $section = $(this); | var $section = $(this); | ||
if (!$section.hasClass('mw-collapsible')) { | if (!$section.hasClass('mw-collapsible')) { | ||
$section.addClass('mw-collapsible mw-collapsed'); | $section.addClass('mw-collapsible mw-collapsed'); | ||
$section.wrapInner('<div class="mw-collapsible-content"></div>'); | $section.wrapInner('<div class="mw-collapsible-content"></div>'); | ||
var $heading = $section.prev('h1, h2'); | var $heading = $section.prev('h1, h2'); | ||
$heading.css('cursor','pointer').click(function() { | $heading.css('cursor','pointer').click(function() { |
2025年8月24日 (日) 22:19時点における版
/* ここにある全てのJavaScriptはモバイル版サイトの利用者に影響します */ mw.hook('mobileFrontend.content').add(function($content) { $content.find('section.collapsible-block').each(function() { var $section = $(this); if (!$section.hasClass('mw-collapsible')) { $section.addClass('mw-collapsible mw-collapsed'); $section.wrapInner('<div class="mw-collapsible-content"></div>'); var $heading = $section.prev('h1, h2'); $heading.css('cursor','pointer').click(function() { $section.toggleClass('mw-collapsed'); }); } }); });