in Joomla Templates by teddydebehr (200 points)
edited by teddydebehr
I´m looking for a function that will be run in a template toaster template smooth scroll to anchor !

Please help.

Thank´s from Germany

2 Answers

by lisa-west (35.1k points)

As I am unable to clearly understand your query, please elaborate it little more so that  I can clearly understand and guide you accordingly.

by bp-web (400 points)
I did use the below script that i found on https://css-tricks.com/snippets/jquery/smooth-scrolling/:

I pasted the script just before the </head> tag in the index.php file of the template and created an anchor and anchor link with JCE. This worked fine for me.

<!-- SMOOTH SCROLL -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function() {
  $('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;
      }
    }
  });
});
</script>
<!-- End of SMOOTH SCROLL -->
by teddydebehr (200 points)
Thank´s a lot it works.
Have a nice day from Germany
Interested in localizing/Translating TemplateToaster Software in your native language in exchange of a Pro License ? Contact Us
...