Hi
I'm using anchor links in a nav menu but have noticed that when I enable pretty urls, the anchor links in the nav menu stop working and nothing happens when I click on them
If I remove the following from the htacess file, the anchor links work again on the home page
I can't do that thought as need the pretty urls enabled. Has anyone got a workaround please?
UPDATE: The anchor links work on the index.php (homepage) but the anchor links don't work if on another page
UPDATE: Think I managed to solve it with the following code and looks to be working
I'm using anchor links in a nav menu but have noticed that when I enable pretty urls, the anchor links in the nav menu stop working and nothing happens when I click on them
If I remove the following from the htacess file, the anchor links work again on the home page
- Code: Select all
#index.php
RewriteRule ^.*?([^\.\/]*)\.html$ ?pname=$1 [L,QSA]
RewriteRule ^([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ ?d=$1$2$3 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)/$ ?fname=$1 [L,QSA]
RewriteRule ^\w[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
I can't do that thought as need the pretty urls enabled. Has anyone got a workaround please?
UPDATE: The anchor links work on the index.php (homepage) but the anchor links don't work if on another page
UPDATE: Think I managed to solve it with the following code and looks to be working
- Code: Select all
<li><a href="<cms:show k_site_link /><cms:show nav_link/>"><cms:show nav_title/></a></li>
<script>
$(document).on('click', 'a[href^="#"]', function (event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 800);
}
});
</script>