Reputation: 682
I am creating a small directory with links to scroll to the alphabetical list within a scrollable div. I need to have the contents of the div scroll only not the entire page. I am using Smooth scroll found here:
https://github.com/kswedberg/jquery-smooth-scroll
This is my code:
$(document).ready(function() {
$('.quick_links li a').click(function() {
$.smoothScroll({
scrollElement: $('#designers_box'),
scrollTarget: '#designers_box'
});
return false;
});
});
I know I shouldn't use #designers_box on both arguments but not really understanding the documentation. Is anyone familiar with this?
Here is a link to the work:
http://fourcemag.kenaesthetic.com/homme/index.htm
You will see it is doing something but not quite working yet. Thanks for the help all.
Upvotes: 1
Views: 3468
Reputation: 13620
Your scrollElement
is what is scrolled and your scrollTarget
is where it is scrolled to.
So, this would be my guess:
$(document).ready(function() {
$('.quick_links li a').click(function() {
$.smoothScroll({
scrollElement: $('#designers_box'),
scrollTarget: $(this).attr('href')
});
return false;
});
});
Upvotes: 2