Anchor smooth scrolling in the inner pages

Responsive, suitable for any type of business, built for any needs elegant one-page Joomla template.
Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Wed Jun 11, 2014 8:45 am
Reply with quote
Report this post
Dear developers,

Is it possible to use anchor smooth scrolling for the inner pages? I use creativity template and all works perfectly, but I have a couple pages with a lot of chapters and I try to use anchor link with smooth scrolling but it's doesn't work. For smooth scrolling I used this jquery script:
Code: Select all
$('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;
        }
    }
});


Thank you for answer
User avatar
Fresh Boarder

GK User
Wed Jun 11, 2014 10:17 am
Reply with quote
Report this post
If the script is loaded on inner page it should scroll without any problems in smooth way. Could you show me example page where do you use internal anchor points?
User avatar
Platinum Boarder

GK User
Wed Jun 11, 2014 11:43 am
Reply with quote
Report this post
Thank you, bkrztuk for the fast answer

after my post, I looked at my code again. And found the mistake - I used html code <a name="zzz"> but should use "id=" :woohoo:
User avatar
Fresh Boarder

GK User
Fri Jun 13, 2014 9:49 am
Reply with quote
Report this post
No problem at all, thanks for explaining your problem because usually user mistakes are very similar so maybe someone else will have this kind or problem.
User avatar
Platinum Boarder


cron