views:

58

answers:

2

I'm using this accordion script for a simple FAQ page.

http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

I tried adding

http://mix26.com/demo/local_scroll/index.html

the ScrollTo so when a question is opened, it scrolls down to it automatically for a better user experience. Can someone please help me?

+2  A: 

I used:

function goToByScroll(id){
    $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}

and assigned goToByScroll to each div, worked like a charm.

Reden
A: 

Sorry about my english!!

Hi i recently had your problem. Here is my solution: Of course you will need to add jquery.scrollTo-min.js If you see in change i add the scroll to and assign it to .open css class that it is assigned by accordeon to the item that opens

        $(function () {
        $('ul.drawers').accordion({
            header: 'H2.drawer-handle',
            selectedClass: 'open',
            event: 'click',
            change: function(event, ui){
                $.scrollTo('.open',800, {duration:500} ); return false;
            },
            autoheight: false
        });             
    });
Fede