MediaWiki:TemplateTabs.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/**
* This script interacts with [[Template:Tabs]]
* [[Category:Template script pages]]
*/
$( '.template-tabs' ).each( function () {
$( this ).children( '.template-tabs-tab' ).each( function ( index ) {
$( this ).click( function () {
var tab = $( this );
tab.children( 'span' ).addClass( 'active' )
tab.siblings( '.template-tabs-tab' ).children( 'span' ).removeClass( 'active' );
tab.siblings( '.template-tabs-content' ).hide().eq( index ).show();
} );
} );
} );