accordion.css
3 months ago
button.css
4 weeks ago
card.css
3 months ago
common.css
3 months ago
common.js
3 months ago
deprecated.css
3 months ago
form.css
3 months ago
header.css
3 months ago
modal-new.css
3 months ago
modal.css
3 months ago
modal.js
3 months ago
screen-options.js
3 months ago
tabs.js
3 months ago
toast.css
3 months ago
toaster.js
3 months ago
toggles.js
3 months ago
tabs.js
30 lines
| 1 | import jQuery from 'jquery'; |
| 2 | |
| 3 | export function tabs() { |
| 4 | const tabElems = jQuery( '.advads-tab-menu', '.advads-tab-container' ); |
| 5 | tabElems.on( 'click', 'a', function ( event ) { |
| 6 | event.preventDefault(); |
| 7 | const link = jQuery( this ); |
| 8 | const parent = link.closest( '.advads-tab-container' ); |
| 9 | const target = jQuery( link.attr( 'href' ) ); |
| 10 | |
| 11 | parent.find( 'a.is-active' ).removeClass( 'is-active' ); |
| 12 | link.addClass( 'is-active' ); |
| 13 | |
| 14 | parent.find( '.advads-tab-target' ).hide(); |
| 15 | target.show(); |
| 16 | } ); |
| 17 | |
| 18 | // Trigger tab |
| 19 | tabElems.each( function () { |
| 20 | const thisContainer = jQuery( this ); |
| 21 | const { hash = false } = globalThis.location; |
| 22 | let tab = thisContainer.find( 'a:first' ); |
| 23 | |
| 24 | if ( hash && thisContainer.find( 'a[href=' + hash + ']' ).length > 0 ) { |
| 25 | tab = thisContainer.find( 'a[href=' + hash + ']' ); |
| 26 | } |
| 27 | tab.trigger( 'click' ); |
| 28 | } ); |
| 29 | } |
| 30 |