Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Smooth Scrolling ***SOLVED***


Go to End


4 Posts   2012 Views

Avatar
vincent_vega

Community Member, 14 Posts

20 April 2012 at 1:14pm

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?

Avatar
copernican

Community Member, 189 Posts

20 April 2012 at 1:52pm

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.

Avatar
vincent_vega

Community Member, 14 Posts

20 April 2012 at 2:30pm

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>

Avatar
vincent_vega

Community Member, 14 Posts

20 April 2012 at 5:15pm

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>