-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
160 lines (138 loc) · 6.17 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
const rulerPoints = document.querySelectorAll(".overlay-points span");
for (i = 0; i < rulerPoints.length; i++) {
rulerPoints[i].addEventListener("mouseover", function(e) {
let top = parseInt(this.style.bottom);
let right = parseInt(this.style.left);
top = 100 - top;
right = 100 - right;
// console.log(top);
document.querySelector(".markerBorder").style.visibility = "visible";
document.querySelector(".markerBorder").style.top = top + "%";
document.querySelector(".markerBorder").style.right = right + "%";
let idName = String(this.dataset.id);
if (idName.indexOf(',') > -1) {
let idArr = idName.split(',');
for(i=0; i< idArr.length; i++){
document.getElementById(idArr[i]).style.border = "1px solid red";
}
}else{
// console.log(`#${idName} .accordion-header`);
document.querySelector(`#${idName} .accordion-header`).style.backgroundColor = "#8dc8e8";
document.querySelector(`#${idName} .accordion-header button`).style.fontWeight = "700";
}
});
rulerPoints[i].addEventListener("mouseout", function(e) {
document.querySelector(".markerBorder").style.top = 0;
document.querySelector(".markerBorder").style.right = 0;
document.querySelector(".markerBorder").style.visibility = "hidden";
let idName = String(this.dataset.id);
if (idName.indexOf(',') > -1) {
let idArr = idName.split(',');
for(i=0; i< idArr.length; i++){
document.getElementById(idArr[i]).style.border = "none";
}
}else{
document.querySelector(`#${idName} .accordion-header`).style.backgroundColor = "white";
document.querySelector(`#${idName} .accordion-header button`).style.fontWeight = "400";
}
});
}
const accordionPoints = document.querySelectorAll(".accordion-item");
for(i = 0; i< accordionPoints.length; i++){
accordionPoints[i].addEventListener("mouseover", function(e){
let idName = String(this.id);
console.log(idName);
const mouseoverEvent = new Event('mouseover');
document.querySelector(`.overlay-points span[data-id=${idName}]`).dispatchEvent(mouseoverEvent);
document.querySelector(`.overlay-points span[data-id=${idName}]`).style.transform = "translate(-50%, 50%) scale(1.2)"
});
accordionPoints[i].addEventListener("mouseout", function(e){
let idName = String(this.id);
console.log(idName);
const mouseoutEvent = new Event('mouseout');
document.querySelector(`.overlay-points span[data-id=${idName}]`).dispatchEvent(mouseoutEvent);
document.querySelector(`.overlay-points span[data-id=${idName}]`).style.transform = ""
});
}
// $(`input:checkbox`).on('click', function() {
// var $box = $(this);
// if ($box.is(":checked")) {
// // $(`input:checkbox`).prop("checked", false);
// $box.prop("checked", true);
// let filterId = $box.attr("id");
// if(filterId == 'All'){
// $(".overlay-points span, .accordion-item").css("display", "block");
// }else{
// $(".overlay-points span, .accordion-item").css("display", "none");
// if($(`.${filterId}`).css("display") == 'none'){
// $(`.${filterId}`).css("display", "block");
// }
// }
// } else {
// $box.prop("checked", true);
// let filterId = $box.attr("id");
// if($(`.${filterId}`).css("display") == 'block'){
// $(`.${filterId}`).css("display", "none");
// }
// }
// });
$(`input:checkbox`).on('click', function() {
$('.overlay-points span, .accordion-item').css('display','none');
let checkedEle = [];
if($(this).is(":checked") && $(this).attr("id") == "All"){
$(`input:checkbox`).prop("checked", false);
$(`input:checkbox#All`).prop("checked", true);
// $('.overlay-points span').css('display','true');
checkedEle = ['creator', 'trust', 'strategic', 'material']
}else if($(this).is(":checked") && this != "All"){
$(`input:checkbox#All`).prop("checked", false);
let checkedBox = document.querySelectorAll(`input:checked`);
for(i=0; i< checkedBox.length; i++){
checkedEle.push($(checkedBox[i]).attr("id"))
}
}
else if($(this).is(":checked")){
let checkedBox = document.querySelectorAll(`input:checked`);
for(i=0; i< checkedBox.length; i++){
checkedEle.push($(checkedBox[i]).attr("id"))
}
}
else{
// $(`input:checkbox`).prop("checked", false);
// $(`input:checkbox#All`).prop("checked", true);
let checkedBox = document.querySelectorAll(`input:checked`);
if(checkedBox.length == 0){
$(`input:checkbox#All`).prop("checked", true);
checkedEle = ['creator', 'trust', 'strategic', 'material'];
}else{
for(i=0; i< checkedBox.length; i++){
checkedEle.push($(checkedBox[i]).attr("id"))
}
}
}
for(let i=0; i<checkedEle.length; i++){
if(checkedEle[i] == "creator"){
$('.creator').css("display","block")
}else if(checkedEle[i] == "trust"){
$('.trust').css("display","block")
}else if(checkedEle[i] == "strategic"){
$('.strategic').css("display","block")
}else if(checkedEle[i] == "material"){
$('.material').css("display","block")
}else{
$('.overlay-points span').css('display','block');
}
}
console.log(checkedEle, "hello");
});
// for triggering popover on hover
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
$('.openBtn').on('click',function(){
var url = $(this).attr("data-url") //your page url
$('.modal-body').load(url,function(){
$('.modal').show();
});
});