Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- document.querySelectorAll('.all-resources').forEach(function(element) {
- element.classList.add('w--current');
- });
- document.addEventListener('DOMContentLoaded', function () {
- var $tabHeadersItems = $('.resources-tab-wrapper .tab-link-default');
- var $tabBodyItems = $('.article-item');
- $tabHeadersItems.each(function() {
- $(this).on('click', function() {
- var currentData = $(this).data('category');
- // Снимаем выделение с предыдущих вкладок и применяем к текущей
- $('.all-resources').removeClass('w--current');
- $tabHeadersItems.removeClass('w--current');
- $(this).addClass('w--current');
- $(`.article-item`).hide();
- $(`.article-item[data-category="${currentData}"]`).show();
- });
- });
- $('.all-resources').on('click', function(){
- $tabHeadersItems.removeClass('w--current');
- $(this).addClass('w--current');
- $(`.article-item`).show();
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement