-
Notifications
You must be signed in to change notification settings - Fork 0
/
scriptsix.js
70 lines (59 loc) · 2.17 KB
/
scriptsix.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
// Function to open the popup and apply effects
function openPopup() {
// Display the div with class "mpopupsix"
document.querySelector('.mpopupsix').style.display = 'block';
// Add blur effect and disable pointer events for the specified divs
const divsToBlur = [
'#home-mobile',
'#about-mobile',
'#services-mobile',
'#reviews-mobile',
'#contact-mobile',
'#navbar-mobile',
];
divsToBlur.forEach(selector => {
const element = document.querySelector(selector);
if (element) {
element.style.filter = 'blur(20px)';
element.style.pointerEvents = 'none'; // Make the content unclickable
}
});
// Scroll the page to the "services-mobile" div
const servicesDiv = document.querySelector('#services-mobile');
if (servicesDiv) {
servicesDiv.scrollIntoView({ behavior: 'smooth' });
}
// Disable scroll functionality on the page
document.body.style.overflow = 'hidden';
}
// Function to close the popup and remove effects
function closePopup() {
// Hide the div with class "mpopupsix"
document.querySelector('.mpopupsix').style.display = 'none';
// Remove blur effect and enable pointer events for the specified divs
const divsToBlur = [
'#home-mobile',
'#about-mobile',
'#services-mobile',
'#reviews-mobile',
'#contact-mobile',
'#navbar-mobile',
];
divsToBlur.forEach(selector => {
const element = document.querySelector(selector);
if (element) {
element.style.filter = 'none';
element.style.pointerEvents = 'auto'; // Restore click functionality
}
});
// Re-enable scroll functionality on the page
document.body.style.overflow = 'auto';
// Ensure the page stays scrolled to the "services-mobile" div
const servicesDiv = document.querySelector('#services-mobile');
if (servicesDiv) {
servicesDiv.scrollIntoView({ behavior: 'smooth' });
}
}
// Attach the functions to the respective buttons
document.querySelector('.mpopsix').onclick = openPopup;
document.querySelector('#popupsix-mobile').onclick = closePopup;