forked from saqi/Maybank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestimonials.js
29 lines (28 loc) · 892 Bytes
/
testimonials.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
;(function () {
var testimonials = document.querySelectorAll('#testimonials .flex-container .testi');
var ul = document.querySelector('#testimonials div ul');
var counter = 1;
var order = 0;
testimonials.forEach(function (item) {
var li = document.createElement('li');
console.log(li);
var a = document.createElement('a');
a.setAttribute('href', '#');
//a.setAttribute('class', 'dot');
a.appendChild(document.createTextNode(counter));
li.setAttribute('id', counter++);
console.log(li);
li.append(a);
console.log(li);
ul.append(li);
});
ul.querySelectorAll('li').forEach(function (item) {
item.addEventListener('click', function (ev) {
testimonials.forEach(function (item) {
item.style.display = 'none';
});
ev.preventDefault();
testimonials[this.id-1].style.display = 'block';
});
});
})();