开发者

Is it possible to add ScrollTo to my accordion FAQ page?

I'm using this accordion script fo开发者_JS百科r 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?


I used:

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

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


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
        });             
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜