sgerbhctim
sgerbhctim

Reputation: 3640

some problems regarding jquery scrolling

This is the fiddle: http://jsfiddle.net/mitchbregs/KkgkQ/3/ This is the fullscreen fiddle: http://jsfiddle.net/mitchbregs/KkgkQ/3/embedded/result/

I can't get anything to work here. When someone selects something on the left navbar, I want it to scroll to the area necessary. Also, once this is done, I would like to have the jQuery removeClass of the selected on and turn it back into the option.. You could see it if you take a look at the html/css.

I have used all these methods:
Method 1: http://www.mediacollege.com/internet/javascript/page/scroll.html
Method 2: http://blog.freelancer-id.com/2009/03/26/scroll-window-smoothly-in-jquery/
Method 3: How to scroll the window using JQuery $.scrollTo() function

Thank you so much everyone who answers!

Upvotes: 0

Views: 42

Answers (1)

Mihai Iorga
Mihai Iorga

Reputation: 39704

add ID to every "section in page" and bind clicks on menu:

$(document).ready(function(){
    $('.contacts').on('click', function(){ 
        $('html, body').animate({
            scrollTop: $('#scroll_contact').offset().top
        }, 1000);
        $('.list_options_selected').attr('class', 'list_options');
        $(this).children(":first").attr('class', 'list_options_selected');
    })
});​

here is JSFiddle

Upvotes: 1

Related Questions