Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Smooth Scrolling ***SOLVED***

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 647 Views
  • vincent_vega
    Avatar
    Community Member
    14 Posts

    Smooth Scrolling ***SOLVED*** Link to this post

    implementing a "back to top" with a slow smooth scroll but doesn't work when i integrate it into SS?
    is this a SS problem?

  • IOTI
    Avatar
    Community Member
    189 Posts

    Re: Smooth Scrolling ***SOLVED*** Link to this post

    I'm assuming you're using jQuery to do this? SS should not be the issue here.

    have you checked the console to make sure there are no errors? have you ensured that all of your paths are correct. If you could show me some code that would help.

  • vincent_vega
    Avatar
    Community Member
    14 Posts

    Re: Smooth Scrolling ***SOLVED*** Link to this post

    All paths look right & no errors?

    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script src="mysite/javascript/backtotop.js"></script>

    code located in backtotop.js

    $(document).ready(function() {

          $('a[href=#top]').click(function(){
       $('html, body').animate({scrollTop:0}, 'slow');
       return false;
          });

       });

    Html <a href="#top"><img src="themes/blackcandy/images/up.png" alt="Back To Top" /></a>

  • vincent_vega
    Avatar
    Community Member
    14 Posts

    Re: Smooth Scrolling ***SOLVED*** Link to this post

    tried another

    jQuery(document).ready(function($) {

       $(".scroll").click(function(event){      
          event.preventDefault();
          $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
       });
    });

    & used a "class" & it worked?

    <a href="#" class="scroll">back to top</a>

    647 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.