We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered Named Anchor

    • 40088
    • 708 Posts
    I'm using this

    <a href="[[~[[*id]]]]#expenses">expenses</a>


    to link to the "expenses" id at the bottom of a page. Both the link and anchor are on the same page. Clicking the link does take me to the anchor, the problem is when I add jQuery Smooth Scroll

    $.localScroll({
    lazy: true,
    stop: true,
    hash: true
    });


    as soon as the anchor is reached the page redirects to the homepage.

    Revo 2.2.5

    This question has been answered by jeffmiranda. See the first response.

    [ed. note: todd.b last edited this post 11 years, 5 months ago.]
      Todd
      • 22840
      • 1,572 Posts
      do you have the following in the header of your template ?
      <base href="[[!++site_url]]">
        • 40088
        • 708 Posts
        Quote from: paulp at Nov 08, 2012, 09:00 AM
        do you have the following in the header of your template ?
        <base href="[[!++site_url]]">

        Yes I do.
          Todd
          • 22427
          • 793 Posts
          $.localScroll({

          Don't you need
          $('#expenses').localScroll({
          ?
            • 40088
            • 708 Posts
            Quote from: ottogal at Nov 09, 2012, 02:18 AM
            Don't you need
            $('#expenses').localScroll({
            ?

            While your suggestion prevents being redirected to the homepage once the anchor is reached, it breaks the smooth scroll effect; it simply jumps to the anchor.
              Todd
            • Quote from: todd.b at Nov 08, 2012, 05:57 AM
              I'm using this

              <a href="[[~[[*id]]]]#expenses">expenses</a>


              to link to the "expenses" id at the bottom of a page. Both the link and anchor are on the same page. Clicking the link does take me to the anchor, the problem is when I add jQuery Smooth Scroll

              $.localScroll({
              lazy: true,
              stop: true,
              hash: true
              });


              as soon as the anchor is reached the page redirects to the homepage.

              Revo 2.2.5

              If I read this right, the link is always on the same page as the anchor, correct? If so, wouldn't the href just be "#expenses"? This looks like the way localscroll wants the link set up (my guess is that the plugin doesn't have a preventDefault attached to the link, so on click it runs the JQuery THEN process the href link)

              Jason
              • discuss.answer
                • 37031
                • 93 Posts
                Quote from: todd.b at Nov 08, 2012, 05:57 AM
                I'm using this

                <a href="[[~[[*id]]]]#expenses">expenses</a>


                to link to the "expenses" id at the bottom of a page. Both the link and anchor are on the same page. Clicking the link does take me to the anchor, the problem is when I add jQuery Smooth Scroll

                $.localScroll({
                lazy: true,
                stop: true,
                hash: true
                });


                as soon as the anchor is reached the page redirects to the homepage.

                Revo 2.2.5

                Hi todd.b!

                If you're still having problems check out a small site I did that uses that scrolling effect extensively:

                http://www.underworldservices.com

                except that instead of localScroll I'm using:
                $(document).ready(function() {
                    $('.scrollme').smoothScroll({
                        speed: 1200
                    });
                });

                It's called Smooth Scroll - v1.4.6 from Karl Swedberg.
                  • 40088
                  • 708 Posts
                  Hi Jeff, that worked great. Thank you. I like your site too.
                    Todd
                    • 37031
                    • 93 Posts
                    Thanks todd.b, happy to help smiley