-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid.js
59 lines (49 loc) · 1.37 KB
/
grid.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
/*-----
Spanizer
- Wraps letters with spans, for css animations
-----*/
(function($) {
var s,
spanizeLetters = {
settings: {
letters: $('.js-spanize'),
},
init: function() {
s = this.settings;
this.bindEvents();
},
bindEvents: function(){
s.letters.html(function (i, el) {
//spanizeLetters.joinChars();
var spanizer = $.trim(el).split("");
return '<span>' + spanizer.join('</span><span>') + '</span>';
});
},
};
spanizeLetters.init();
})(jQuery);
/*form*/
var selected = document.querySelector(".selected");
var optionsContainer = document.querySelector(".options-container");
var optionsList = document.querySelectorAll(".option");
selected.addEventListener("click", () => {
optionsContainer.classList.toggle("active");
});
optionsList.forEach(o => {
o.addEventListener("click", () => {
selected.innerHTML = o.querySelector("label").innerHTML;
optionsContainer.classList.remove("active");
});
});
var se = document.querySelector(".selected2");
var oc = document.querySelector(".options-container2");
var ol = document.querySelectorAll(".option2");
se.addEventListener("click", () => {
oc.classList.toggle("active2");
});
ol.forEach(o => {
o.addEventListener("click", () => {
se.innerHTML = o.querySelector("label2").innerHTML;
oc.classList.remove("active2");
});
});