Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Make jquery available for other scripts, close #4
  • Loading branch information
kthoden committed Dec 17, 2020
1 parent 7b90d43 commit d122cb3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/pug/base/head.pug
@@ -1,3 +1,4 @@
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
meta(name="viewport" content="width=device-width, initial-scale=1")
script(src="https://code.jquery.com/jquery-3.5.1.min.js")
2 changes: 1 addition & 1 deletion src/scripts/modules/BlockExpand.js
@@ -1,4 +1,4 @@
import $ from 'jquery';
/* eslint-disable */

export default () => {
const blocks = $('.expand-block');
Expand Down
10 changes: 9 additions & 1 deletion src/scripts/modules/accordion.js
@@ -1,4 +1,4 @@
import $ from 'jquery';
/* eslint-disable */

export default () => {
$('.accordion').on('click', '.accordion__title', function acc(e) {
Expand Down Expand Up @@ -194,6 +194,7 @@ export default () => {
&& !$('.publications-popup-sup').is(e.target)
&& !$('.publications-popup-para').is(e.target)
&& !$('.publications-popup-text').is(e.target)
&& !$('.publications-popup-text > *').is(e.target)
) {
infobox.remove();
$('.publications-popup').removeClass('active');
Expand All @@ -204,4 +205,11 @@ export default () => {
e.stopPropagation();
}
});
const urlHash = window.location.hash;
$('.accordion__title').each(function showHashItem() {
if ($(this).attr('href') === urlHash) {
$(this).closest('.accordion__item').addClass('active');
$(this).next('.accordion__content').css('display', 'block');
}
});
};
2 changes: 1 addition & 1 deletion src/scripts/modules/button-dropdown.js
@@ -1,4 +1,4 @@
import $ from 'jquery';
/* eslint-disable */

export default () => {
function buttonOpen() {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/modules/mobile-header.js
@@ -1,4 +1,4 @@
import $ from 'jquery';
/* eslint-disable */

export default () => {
const nav = $('nav.nav');
Expand Down
12 changes: 11 additions & 1 deletion src/scripts/modules/tabs.js
@@ -1,4 +1,4 @@
import $ from 'jquery';
/* eslint-disable */

export default () => {
$('.tabs__items').on('click', '.tabs__item', (e) => {
Expand All @@ -15,6 +15,16 @@ export default () => {
.addClass('active');
});

$('.tabs__items').on('click', '.tabs__item.active', function tabs() {
$(this)
.removeClass('active').siblings().removeClass('active')
.closest('.tabs')
.find('.tabs__content-item')
.removeClass('active')
.eq($(this).index())
.removeClass('active');
});

$(window).on('load', () => {
const tabsItem = $('.tabs__item');
const tabsHead = $('.tabs__head');
Expand Down

0 comments on commit d122cb3

Please sign in to comment.