-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
71 lines (53 loc) · 1.94 KB
/
app.js
File metadata and controls
71 lines (53 loc) · 1.94 KB
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
document.body.onload = addElement();
function addElement(){
var divElem = document.createElement("div");
var porcentaje = document.createElement("a");
var aElem = document.createElement("a",{
"id": "id",
"class": "this that and so on",
"data-whatever": "whatever data",
});
divElem.setAttribute('class', 'divElem')
divElem.style.width = "100%"
document.body.appendChild(divElem);
aElem.setAttribute('class', 'aElem');
aElem.setAttribute('href', 'javascript:window.open("http://hekvh.com")');
aElem.innerHTML = "DRINK ME";
aElem.style.marginLeft = "10px";
divElem.appendChild(aElem); //
porcentaje.setAttribute('class', 'aElem');
var eatMe = document.createElement("a");
eatMe.setAttribute('class', 'aElem');
eatMe.setAttribute('opacity', '1');
eatMe.setAttribute('href', '');
eatMe.style.opacity = '1';
eatMe.innerHTML = "EAT ME";
console.log("hola");
eatMe.style.marginLeft = "10px";
divElem.appendChild(eatMe);
porcentaje.setAttribute('href', 'javascript:window.open("http://hekvh.com")');
porcentaje.innerHTML = "100%";
porcentaje.style.marginLeft = "10px";
divElem.appendChild(porcentaje);
eatMe.addEventListener('click', () => {
alert(opacidad);
})
//AQUI LA RAMA EJEMPLO 11
var opacidad = eatMe.style.opacity;
var intervalo = setInterval(function () {
/*if(eatMe.style.visibility === 'hidden'){
eatMe.style.visibility = 'visible';
} */
opacidad = eatMe.style.opacity;
opacidad = parseFloat(opacidad);
console.log(opacidad);
opacidad = opacidad - 0.1
console.log(opacidad);
eatMe.style.opacity = opacidad.toString();
console.log(eatMe.style.opacity);
porcentaje.innerHTML = " " + (eatMe.style.opacity * 100) + " %";
if (opacidad == 0) {
clearInterval(intervalo);
}
}, 500);
}