-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
52 lines (39 loc) · 1.2 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
$(document).ready(function(){
$('#menu').click(function(){
$(this).toggleClass('fa-times');
$('header').toggleClass('toggle');
});
$(window).on('scroll load',function(){
$('#menu').removeClass('fa-times');
$('header').removeClass('toggle');
if($(window).scrollTop() > 0){
$('.top').show();
}else{
$('.top').hide();
}
});
$('a[href*="#"]').on('click',function(e){
e.preventDefault();
$('html, body').animate({
scrollTop : $($(this).attr('href')).offset().top,
},
500,
'linear'
);
});
});
const scriptURL = 'https://script.google.com/macros/s/AKfycbwhoi-AeiO3AflBhXZCvS47BjY0wA6gunoM6_ijU3zK5E3dSBONhB1hKx5SFwpdL_ctgg/exec'
const form = document.forms['submit-to-google-sheet']
const msg = document.getElementById("msg")
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form) })
.then(response => {
msg.innerHTML = "Message sent successfully"
setTimeout(function () {
msg.innerHTML = ""
}, 5000)
form.reset()
})
.catch(error => console.error('Error!', error.message))
})