Hello,
when a visitor is in a page, and it clicks on the menu over the same page link, it doesn’t reload the page. My client asked me to make the menu so that it reloads the page you are on if you click on it in the menu (ex. you are in “contact”, and you click “contact” on the menu, it should reload the page instead of bringing you to the top, which is what happens normally).
I found this thread with this code snippet
function avia_cu
stom_js_footer_code(){
?>
<script type=”text/javascript”>
jQuery(document).ready(function(){
jQuery(“.avia-menu li:not(.menu-item-avia-special) a”).click(function(){
location.reload(true);
});
});
</script>
<?php
}
add_action(‘wp_footer’, ‘avia_custom_js_footer_code’);`
which seems to have solved the issue for the original poster, but my website is still not working correctly. It seems to reload the same page you are in over and over again, instead of bringing you to the page you click on. Can you help me with this?
Hey grendelica,
Please remove this code and let us check without it.
Best regards,
Victoria
Hello, sorry for the late answer. I have commented the code in functions.php
Hi grendelica,
Please try the code like this:
function avia_custom_js_footer_code(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".current-menu-item a").click(function(){
location.reload(true);
});
});
</script>
<?php
}
add_action('wp_footer', 'avia_custom_js_footer_code');
Best regards,
Victoria
Everything seems to be working.
Thanks!
Hi,
Glad Victoria could help! :)
For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/
If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)
Best regards,
Yigit