webseite-grav/plugins/form/app/fields/tabs.js

15 lines
398 B
JavaScript
Raw Permalink Normal View History

2021-04-30 11:23:26 +02:00
import $ from 'jquery';
$('body').on('touchstart click', '[data-tabid]', (event) => {
event && event.stopPropagation();
let target = $(event.currentTarget);
const panel = $(`[id="${target.data('tabid')}"]`);
target.siblings('[data-tabid]').removeClass('active');
target.addClass('active');
panel.siblings('[id]').removeClass('active');
panel.addClass('active');
});