Jump to content

Recommended Posts

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Former Staff

jQuery( document ).ready(function() {
    jQuery('.scroll-smooth').click(function (e) {
        e.preventDefault();
        var status_id = $(this).attr('href').split('#');
        var element = jQuery("#" + status_id[1]);
        if(element.length > 0) {
            scroll = element.offset().top - 40;
            jQuery("html, body").animate({
                scrollTop: scroll
            }, 1000);
        }
    });
});
Now just attach the class "scroll-smooth" your button an in the href tag you put your id you want to scroll to (if you want to go top give the body the id scrolltop and let the link look like that:

<a href="#scrolltop">LINK</a>

 

You can watch a demo here:

http://pollux2.com/stats

 

At the bottom you find "Nach oben" (german for to top) click on that and it will smothly scroll to top

Link to comment
Share on other sites

jQuery( document ).ready(function() {
    jQuery('.scroll-smooth').click(function (e) {
        e.preventDefault();
        var status_id = $(this).attr('href').split('#');
        var element = jQuery("#" + status_id[1]);
        if(element.length > 0) {
            scroll = element.offset().top - 40;
            jQuery("html, body").animate({
                scrollTop: scroll
            }, 1000);
        }
    });
});
Now just attach the class "scroll-smooth" your button an in the href tag you put your id you want to scroll to (if you want to go top give the body the id scrolltop and let the link look like that:

<a href="#scrolltop">LINK</a>

 

You can watch a demo here:

http://pollux2.com/stats

 

At the bottom you find "Nach oben" (german for to top) click on that and it will smothly scroll to top

 

 

Thanks but I don't want this :)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 4

      Feeding game source to LLM

    2. 0

      Quest 6/7 Problem

    3. 5

      Effect weapons

    4. 0

      [C++] Fix Core Downer Using Negative Number in GM Codes

    5. 3

      Crystal Metinstone

    6. 4

      Feeding game source to LLM

    7. 113

      Ulthar SF V2 (TMP4 Base)

    8. 4

      Feeding game source to LLM

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.