-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
76 lines (76 loc) · 2.37 KB
/
script.js
File metadata and controls
76 lines (76 loc) · 2.37 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
// // Smooth Scroll for Anchor Links
// document.querySelectorAll('a[href^="#"]').forEach(anchor => {
// anchor.addEventListener('click', function(e) {
// e.preventDefault();
// document.querySelector(this.getAttribute('href')).scrollIntoView({
// behavior: 'smooth'
// });
// });
// });
//
// // Sticky Header on Scroll
// window.onscroll = function() {
// let header = document.querySelector('header');
// let sticky = header.offsetTop;
// if (window.pageYOffset > sticky) {
// header.classList.add('sticky');
// } else {
// header.classList.remove('sticky');
// }
// };
//
// // Lazy Loading of Images
// document.addEventListener("DOMContentLoaded", function() {
// let lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
//
// if ("IntersectionObserver" in window) {
// let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
// entries.forEach(function(entry) {
// if (entry.isIntersecting) {
// let lazyImage = entry.target;
// lazyImage.src = lazyImage.dataset.src;
// lazyImage.classList.remove("lazy");
// lazyImageObserver.unobserve(lazyImage);
// }
// });
// });
//
// lazyImages.forEach(function(lazyImage) {
// lazyImageObserver.observe(lazyImage);
// });
// }
// });
//
// // Scroll to Top Button
// let scrollTopBtn = document.getElementById("scrollTopBtn");
//
// window.onscroll = function() {
// if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
// scrollTopBtn.style.display = "block";
// } else {
// scrollTopBtn.style.display = "none";
// }
// };
//
// scrollTopBtn.addEventListener("click", function() {
// window.scrollTo({top: 0, behavior: 'smooth'});
// });
//
// // Modal Popup
// let modal = document.getElementById("myModal");
// let btn = document.getElementById("openModalBtn");
// let span = document.getElementsByClassName("close")[0];
//
// btn.onclick = function() {
// modal.style.display = "block";
// }
//
// span.onclick = function() {
// modal.style.display = "none";
// }
//
// window.onclick = function(event) {
// if (event.target == modal) {
// modal.style.display = "none";
// }
// }