-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
99 lines (84 loc) · 2.89 KB
/
Copy pathscript.js
File metadata and controls
99 lines (84 loc) · 2.89 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
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
// mobile navigation
var navLinks = document.getElementById("nav-links");
function showMenu() {
navLinks.style.right = "0";
}
function hideMenu() {
navLinks.style.right = "-200px";
}
// form popup
function openForm() {
document.getElementById("contact-container").style.display = "block";
}
function closeForm() {
document.getElementById("contact-container").style.display = "none";
}
// smtp js code for contact form
function sendEmail() {
Email.send({
SecureToken: "2dddff2a-75d7-4896-9984-3a4770ff0c06",
To: "dcodeplus.languages@gmail.com",
// To: "ajmalullanam5@gmail.com",
// To: "mohamedanaspkm@gmail.com",
From: "testwithajas@gmail.com",
Subject: "Dcodeplus Site Enquiry",
Body:
"This is the enquiry from " +
"<br>" +
document.getElementById("form-name").value +
", <br>" +
document.getElementById("form-message").value +
"<br> <br>" +
" Contact details: <br> email: " +
document.getElementById("form-mail").value +
"<br> Mobile: " +
document.getElementById("form-mobile").value,
}).then((message) => {
if (message == "OK") {
swal("Successfull", "Your message has been sent successfully", "Success"),
(document.getElementById("contact-container").style.display = "none");
} else {
swal("Something wrong", "Your data not received", "error");
}
});
}
// back to top button function
let backToTop = document.getElementById("go2top");
let chatToWA = document.getElementById("chat2wa");
window.onscroll = function () {
scrollFunction();
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
backToTop.style.display = "block";
chatToWA.style.display = "block";
} else {
backToTop.style.display = "none";
chatToWA.style.display = "none";
}
}
// When click on the button, scroll to the top of the document
function goToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
// read more button function
let noOfCharac = 250;
let contents = document.querySelectorAll(".content");
contents.forEach((content) => {
if (content.textContent.length < noOfCharac) {
content.nextElementSibling.style.display = "none";
} else {
let displayText = content.textContent.slice(0, noOfCharac);
let moreText = content.textContent.slice(noOfCharac);
content.innerHTML = `${displayText}<span class="dots">...</span><span class="hide more">${moreText}</span>`;
}
});
function readMore(btn) {
let post = btn.parentElement;
post.querySelector(".dots").classList.toggle("hide");
post.querySelector(".more").classList.toggle("hide");
btn.textContent == "Read More"
? (btn.textContent = "Read Less")
: (btn.textContent = "Read More");
}