Skip to content

Commit f462954

Browse files
Merge pull request #38483 from aireilly/added-back-annoying-alert
Add back annoying alert box on mobile
2 parents 3d0c2e2 + beaa139 commit f462954

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

_templates/_page_openshift.html.erb

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,39 @@
397397
tocItems[tocItems.length - 1].classList.add("toc-active");
398398
};
399399
//scroll to top
400-
if(window.scrollY==0) {
400+
if(window.pageYOffset === 0) {
401401
var tocItems = $("#toc a");
402402
for (let i = 0; i < tocItems.length; i++) {
403-
tocItems[i].classList.remove("toc-active")
404-
}
403+
tocItems[i].classList.remove("toc-active");
404+
};
405+
tocItems[0].classList.add("toc-active");
405406
};
406-
tocItems[0].classList.add("toc-active");
407407
})
408408
</script>
409409

410+
<!-- adjust alerts on mobile -->
411+
<script type="text/javascript">
412+
window.addEventListener("wheel", () => {
413+
if (window.innerWidth < 1425) {
414+
//adjust alert
415+
if(window.pageYOffset > 0) {
416+
document.querySelector('#support-alert').style.position = "fixed";
417+
document.querySelector('#support-alert').style.bottom = "0px";
418+
document.querySelector('#support-alert').style.margin = "5px";
419+
document.querySelector('#support-alert').style.zIndex = "9999999";
420+
}
421+
}
422+
});
423+
window.addEventListener('resize', () => {
424+
if (window.innerWidth >= 1425) {
425+
document.querySelector('#support-alert').style.removeProperty('position');
426+
document.querySelector('#support-alert').style.removeProperty('bottom');
427+
document.querySelector('#support-alert').style.removeProperty('margin');
428+
document.querySelector('#support-alert').style.removeProperty('zIndex');
429+
}
430+
})
431+
</script>
432+
410433
</body>
411434

412435
</html>

0 commit comments

Comments
 (0)