While I have come across some similar posts, my knowledge of Javascript is limited. Can anyone lend a hand?
The code below modifies the CSS Class of
<div class="contact">
and adds extra classes when a main menu link (e.g. #contact
) is clicked to replace the previous page with the new one:
$('.top-menu').on('click', 'a', function(){
// Code snippet here
Is there a way to adjust this code so that any link with a class of changepage
behaves in the same manner?
Furthermore, can this functionality be triggered based on the current page's URL or upon page load, ensuring that if a user lands directly on the contact page, the transition occurs automatically without requiring a click?
Thank you for your assistance.