-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (47 loc) · 1.63 KB
/
Copy pathscript.js
File metadata and controls
58 lines (47 loc) · 1.63 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
function main(){
// Load each section on corresponding button click
handleContentDisplay();
handleContactSubmission();
}
function handleContactSubmission (){
$('#contactForm').submit(e => {
e.preventDefault();
let subject = e.target.subject.value;
let actionSubject = subject.split(' ').join('%20');
// console.log(actionSubject);
let message = e.target.message.value;
let actionMessage = message.split(' ').join('%20');
// console.log(actionMessage);
let actionQuotes = "mailto:kalinramsey@gmail.com?subject=" + actionSubject + "&body=" + actionMessage;
if (e.target.phone.value){
actionQuotes += "%20\nCall%20Me%20at%20" + e.target.phone.value;
}
console.log(actionQuotes);
$('#contactForm').attr('action', `${actionQuotes}`);
e.currentTarget.submit();
});
}
function handleContentDisplay() {
$('#port-btn').on('click', e=>{
// hide current content
hideContent();
// show corresponding content
$('#portfolio').css('display', 'block');
});
$('#about-btn').on('click', e=>{
// hide current content
hideContent();
// show corresponding content
$('#about').css('display', 'block');
});
$('#contact-btn').on('click', e=>{
// hide current content
hideContent();
// show corresponding content
$('#contact').css('display', 'block');
});
}
function hideContent(){
$('#about, #portfolio, #contact').css('display', 'none');
}
$(main);