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?
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.
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.
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>
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>