-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
115 lines (95 loc) · 3.55 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
document.addEventListener('DOMContentLoaded', function(event) {
var dataText = ["Agustín Benítez"];
function typeWriter(text, i, fnCallback) {
if (i < (text.length)) {
document.querySelector(".typing-effect").innerHTML = text.substring(0, i + 1) + '<span aria-hidden="true"></span>';
setTimeout(function() {
typeWriter(text, i + 1, fnCallback)
}, 100);
} else if (typeof fnCallback == 'function') {
setTimeout(fnCallback, 900);
}
}
function startTextAnimation(i) {
if (typeof dataText[i] == 'undefined') {
setTimeout(function() {
startTextAnimation(0);
}, 20000);
}
if (i < dataText.length) {
typeWriter(dataText[i], 0, function() {
startTextAnimation(i + 1);
});
}
}
startTextAnimation(0);
});
// Para el primer botón "bajar"
document.querySelector('.bajar').addEventListener('click', function() {
document.getElementById('knowledge').scrollIntoView({
behavior: 'smooth'
});
});
// Para el segundo botón "bajar1"
document.querySelector('.bajar1').addEventListener('click', function() {
// Obtén el elemento siguiente al conocimiento para desplazarte a él
var nextSection = document.querySelector('.knowledge2');
nextSection.scrollIntoView({
behavior: 'smooth'
});
});
// Para el segundo botón "bajar1"
document.querySelector('.bajar2').addEventListener('click', function() {
// Obtén el elemento siguiente al conocimiento para desplazarte a él
var nextSection = document.querySelector('.projects');
nextSection.scrollIntoView({
behavior: 'smooth'
});
});
// scroll jumps nav
// Selecciona todos los enlaces del menú
const links = document.querySelectorAll('nav ul li a');
// Itera sobre cada enlace
links.forEach(link => {
// Añade un evento de clic a cada enlace
link.addEventListener('click', e => {
// Previene el comportamiento predeterminado de los enlaces
e.preventDefault();
// Obtiene el href del enlace
const href = link.getAttribute('href');
// Obtiene el elemento asociado al href
const targetElement = document.querySelector(href);
// Hace scroll suavemente al elemento
targetElement.scrollIntoView({
behavior: 'smooth'
});
});
});
// Cards
const cards = document.querySelectorAll('.card');
cards.forEach(card => {
card.addEventListener('mouseenter', () => {
card.style.transition = 'transform 0.5s ease';
});
card.addEventListener('mouseleave', () => {
card.style.transition = 'transform 0.5s ease';
card.style.transform = 'rotateY(0deg)';
});
});
const button = document.querySelector('.allp');
// Añade un event listener para el evento 'click'
button.addEventListener('click', function() {
// Abre una nueva pestaña con la URL especificada
window.open('https://github.com/AgustinBeniteez?tab=repositories', '_blank');
});
// Redireccionar a la sección de IMG LOGO
document.getElementById("logo").addEventListener("click", function() {
// Redireccionar a la sección correspondiente
var hash = "#presentation"; // Cambiar al hash de la sección deseada
var targetElement = document.querySelector(hash);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth'
});
}
});