Skip to content

Commit 358951a

Browse files
updates
1 parent aa1855c commit 358951a

2 files changed

Lines changed: 178 additions & 1 deletion

File tree

_layouts/blog-index.html

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,94 @@ <h3 class="modal-title">Need IT Job or Interview Support? We’re Here to Help!<
11901190
const blogLink = document.querySelector('.navbar-nav .nav-link[href="/blog/"]');
11911191
if (blogLink) blogLink.classList.add('active');
11921192
}
1193+
1194+
// Engagement Modal Popup
1195+
let modalShown = false;
1196+
let scrollTriggered = false;
1197+
let timeTriggered = false;
1198+
1199+
// Check if modal was shown recently (24 hours)
1200+
function shouldShowModal() {
1201+
const lastShown = localStorage.getItem('engagementModalLastShown');
1202+
if (!lastShown) return true;
1203+
1204+
const timeDiff = Date.now() - parseInt(lastShown);
1205+
const hoursPassed = timeDiff / (1000 * 60 * 60);
1206+
return hoursPassed >= 24; // Show again after 24 hours
1207+
}
1208+
1209+
function showEngagementModal() {
1210+
if (modalShown || !shouldShowModal()) return;
1211+
1212+
const modal = document.getElementById('engagementModal');
1213+
if (modal) {
1214+
modal.classList.add('active');
1215+
modalShown = true;
1216+
document.body.style.overflow = 'hidden'; // Prevent background scroll
1217+
1218+
// Save timestamp
1219+
localStorage.setItem('engagementModalLastShown', Date.now().toString());
1220+
1221+
// Track event
1222+
if (typeof gtag !== 'undefined') {
1223+
gtag('event', 'engagement_modal_shown', {
1224+
'event_category': 'engagement',
1225+
'event_label': 'modal_displayed'
1226+
});
1227+
}
1228+
}
1229+
}
1230+
1231+
function closeEngagementModal() {
1232+
const modal = document.getElementById('engagementModal');
1233+
if (modal) {
1234+
modal.classList.remove('active');
1235+
document.body.style.overflow = ''; // Restore scroll
1236+
}
1237+
}
1238+
1239+
// Close on overlay click
1240+
document.addEventListener('click', function (e) {
1241+
const modal = document.getElementById('engagementModal');
1242+
if (e.target === modal) {
1243+
closeEngagementModal();
1244+
}
1245+
});
1246+
1247+
// Close on Escape key
1248+
document.addEventListener('keydown', function (e) {
1249+
if (e.key === 'Escape') {
1250+
closeEngagementModal();
1251+
}
1252+
});
1253+
1254+
// Trigger after 5 seconds on page
1255+
// setTimeout(function () {
1256+
// if (!modalShown && shouldShowModal()) {
1257+
// timeTriggered = true;
1258+
// showEngagementModal();
1259+
// }
1260+
// }, 5000);
1261+
1262+
// Trigger on scroll (when user scrolls 10% down)
1263+
let scrollTriggeredFired = false;
1264+
window.addEventListener('scroll', function () {
1265+
if (scrollTriggeredFired || modalShown) return;
1266+
1267+
const scrollPercentage = (window.scrollY / (document.documentElement.scrollHeight - window.innerHeight)) * 100;
1268+
1269+
if (scrollPercentage >= 10 && shouldShowModal()) {
1270+
scrollTriggeredFired = true;
1271+
scrollTriggered = true;
1272+
1273+
// Small delay to not be too aggressive
1274+
setTimeout(function () {
1275+
if (!modalShown) {
1276+
showEngagementModal();
1277+
}
1278+
}, 500);
1279+
}
1280+
});
11931281
</script>
11941282

11951283
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>

_layouts/blog.html

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,8 @@ <h1 class="mb-3">{{ page.title }}</h1>
10791079

10801080
<div class="text-center">
10811081
<h5 class="fw-bold">Need Job Support or Interview Assistance?</h5>
1082-
<a href="https://wa.me/919660614469" class="btn btn-success mt-3">
1082+
<a href="https://wa.me/919660614469" class="btn btn-success mt-3" target="_blank"
1083+
rel="noopener noreferrer">
10831084
<i class="fab fa-whatsapp me-2"></i>Chat on WhatsApp
10841085
</a>
10851086
</div>
@@ -1243,6 +1244,94 @@ <h3 class="modal-title">Need IT Job or Interview Support? We’re Here to Help!<
12431244
link.classList.add('active');
12441245
}
12451246
});
1247+
1248+
// Engagement Modal Popup
1249+
let modalShown = false;
1250+
let scrollTriggered = false;
1251+
let timeTriggered = false;
1252+
1253+
// Check if modal was shown recently (24 hours)
1254+
function shouldShowModal() {
1255+
const lastShown = localStorage.getItem('engagementModalLastShown');
1256+
if (!lastShown) return true;
1257+
1258+
const timeDiff = Date.now() - parseInt(lastShown);
1259+
const hoursPassed = timeDiff / (1000 * 60 * 60);
1260+
return hoursPassed >= 24; // Show again after 24 hours
1261+
}
1262+
1263+
function showEngagementModal() {
1264+
if (modalShown || !shouldShowModal()) return;
1265+
1266+
const modal = document.getElementById('engagementModal');
1267+
if (modal) {
1268+
modal.classList.add('active');
1269+
modalShown = true;
1270+
document.body.style.overflow = 'hidden'; // Prevent background scroll
1271+
1272+
// Save timestamp
1273+
localStorage.setItem('engagementModalLastShown', Date.now().toString());
1274+
1275+
// Track event
1276+
if (typeof gtag !== 'undefined') {
1277+
gtag('event', 'engagement_modal_shown', {
1278+
'event_category': 'engagement',
1279+
'event_label': 'modal_displayed'
1280+
});
1281+
}
1282+
}
1283+
}
1284+
1285+
function closeEngagementModal() {
1286+
const modal = document.getElementById('engagementModal');
1287+
if (modal) {
1288+
modal.classList.remove('active');
1289+
document.body.style.overflow = ''; // Restore scroll
1290+
}
1291+
}
1292+
1293+
// Close on overlay click
1294+
document.addEventListener('click', function (e) {
1295+
const modal = document.getElementById('engagementModal');
1296+
if (e.target === modal) {
1297+
closeEngagementModal();
1298+
}
1299+
});
1300+
1301+
// Close on Escape key
1302+
document.addEventListener('keydown', function (e) {
1303+
if (e.key === 'Escape') {
1304+
closeEngagementModal();
1305+
}
1306+
});
1307+
1308+
// Trigger after 5 seconds on page
1309+
// setTimeout(function () {
1310+
// if (!modalShown && shouldShowModal()) {
1311+
// timeTriggered = true;
1312+
// showEngagementModal();
1313+
// }
1314+
// }, 5000);
1315+
1316+
// Trigger on scroll (when user scrolls 10% down)
1317+
let scrollTriggeredFired = false;
1318+
window.addEventListener('scroll', function () {
1319+
if (scrollTriggeredFired || modalShown) return;
1320+
1321+
const scrollPercentage = (window.scrollY / (document.documentElement.scrollHeight - window.innerHeight)) * 100;
1322+
1323+
if (scrollPercentage >= 10 && shouldShowModal()) {
1324+
scrollTriggeredFired = true;
1325+
scrollTriggered = true;
1326+
1327+
// Small delay to not be too aggressive
1328+
setTimeout(function () {
1329+
if (!modalShown) {
1330+
showEngagementModal();
1331+
}
1332+
}, 500);
1333+
}
1334+
});
12461335
</script>
12471336

12481337

0 commit comments

Comments
 (0)