Skip to content

Commit

Permalink
home page script updated
Browse files Browse the repository at this point in the history
  • Loading branch information
arushsinghh committed Jan 4, 2025
1 parent d54334e commit 26fd09f
Showing 1 changed file with 20 additions and 28 deletions.
48 changes: 20 additions & 28 deletions home/templates/home/home_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,26 @@
</style>

<script>
document.addEventListener("DOMContentLoaded", function() {
var skipLink = document.getElementById('skip-to-content');
var isTabbing = false;
var isMouseActive = false;

window.addEventListener('mousedown', function() {
isMouseActive = true;
document.addEventListener("DOMContentLoaded", function() {
var skipLink = document.getElementById('skip-to-content');
var isTabbing = false;

window.addEventListener('keydown', function(event) {
if (event.key === 'Tab') {
skipLink.classList.add('show');
}
});

window.addEventListener('keydown', function(event) {
if (event.key !== 'Tab') {
skipLink.classList.remove('show');
});

window.addEventListener('keydown', function(event) {
if (isMouseActive) {
return;
}

if (event.key === 'Tab') {
skipLink.classList.add('show');
isTabbing = true;
} else {
skipLink.classList.remove('show');
}
});

skipLink.addEventListener('click', function(event) {
console.log("hii")
event.preventDefault();
document.getElementById('main-content').scrollIntoView({ behavior: 'smooth' });
});
}
});

skipLink.addEventListener('click', function(event) {
event.preventDefault();
document.getElementById('main-content').scrollIntoView({ behavior: 'smooth', block: 'start' });
});
</script>
});
</script>
{% endblock content %}

0 comments on commit 26fd09f

Please sign in to comment.