-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
60 lines (48 loc) · 1.76 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var slider = $('.slider'),
sliderControls = $('.slider-controls'),
sliderItemsWrap = slider.children('.slider-items-wrap'),
sliderItems = sliderItemsWrap.children('.slider-item'),
sliderItemsLength = sliderItems.length;
if (slider) {
var autoSlide = setInterval(function () {
var activeItem = sliderControls.find('.active'),
sliderItemsLength = sliderControls.find('a').length;
if (activeItem.index() !== sliderItemsLength - 1) {
activeItem.next().trigger('click');
} else {
sliderControls.children().first().trigger('click');
}
}, 5000);
}
sliderControls.on('click', 'a', function (e) {
var self = $(this),
index = self.index(),
newColor = sliderItems.eq(index).css('color');
if (!e.isTrigger) clearInterval(autoSlide);
self.addClass('active').siblings().removeClass('active');
slider.css('color', newColor);
sliderItemsWrap.css({
'-webkit-transform': 'translateX(-' + index * sliderItemsWrap.width() / sliderItemsLength + 'px)',
'transform': 'translateX(-' + index * sliderItemsWrap.width() / sliderItemsLength + 'px)'
});
});
document.addEventListener('DOMContentLoaded', function () {
const popup = document.getElementById('changelog-popup');
const openPopupButton = document.getElementById('open-changelog');
const closePopupButton = document.querySelector('.popup-close');
// Open popup
openPopupButton.addEventListener('click', function (e) {
e.preventDefault();
popup.style.display = 'flex';
});
// Close popup
closePopupButton.addEventListener('click', function () {
popup.style.display = 'none';
});
// Close popup when clicking outside of it
window.addEventListener('click', function (e) {
if (e.target === popup) {
popup.style.display = 'none';
}
});
});