开发者

jQuery Accordion - Button problem

I have an accordion that is almost right.

HTML CODE:

    <footer>
    <div>
        <h1>Hide</h1>
        <h1>Hide</h1>
        <h1>Hide</h1>
        <h1开发者_开发技巧>Hide</h1>
        <h1>Hide</h1>
        <h1>Hide</h1>
     <div>
</footer>
<h3><a href="" title="Open footer">Show</a></h3>

I do want that <h3><a href="" title="Open footer">Show</a></h3> stay always on the top and changes name to Hide when is active so, SHOW/HIDE.

I can not see away around. It is at: http://jsfiddle.net/FeGea/1


Try this: http://jsfiddle.net/UHztx/

$('footer').prev('h3').find('a').toggle(function() {
    var sb = $(this).parent().next('footer').slideDown(3200);
    $('html, body').animate({ scrollTop: '+=' + sb.data('expanded-height') }, 3000);
    $(this).text('Hide');
    return false;
}, function() {
    var sb = $(this).parent().next('footer').slideUp(3200);
    $(this).text('Show');
    return false;
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜