-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
56 lines (46 loc) · 1.28 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
// ------------------------------
// Modal actions
// ------------------------------
const modalActions = {
show: (modal) => {
modal.setAttribute("show", "true");
},
hide: (modal) => {
modal.removeAttribute("show", "false");
},
};
// -------------------------------
// MODAL FUNCTIONS
// -------------------------------
/**
* @function
* @name modal
* @param {string} action - Accion que tiene que realizar el modal de nueva receta | tiene que ser open/close
*/
function togglemodal(modalID, action) {
if (action === "open") {
let modal = document.getElementById(modalID);
modalActions.show(modal);
} else if (action === "close") {
let modal = document.getElementById(modalID);
modalActions.hide(modal);
}
}
// -------------------------------
// CARD
// -------------------------------
// CARD WITH TRANSITION
function toggleCard(card_header) {
let growDiv = card_header.parentNode.querySelector("tui-transition-card");
console.log(growDiv.clientHeight);
if (growDiv.clientHeight) {
growDiv.style.height = 0;
} else {
let wrapper = card_header.parentNode.querySelector("tui-card-body");
console.log(wrapper.clientHeight);
growDiv.style.height = wrapper.clientHeight + "px";
}
}
// -------------------------------
// HANDLERS BUTTONS
// -------------------------------