JQuery Accordion - 在按钮上方展开

时间:2013-01-30 15:59:15

标签: jquery dialog accordion expand

过去我询问过当用户想要打开和关闭手风琴时如何打开和关闭手风琴。这是解决问题的例子:

http://jsfiddle.net/JoshuaWaheed/JhndX/

<!DOCTYPE html>

<html>
<!--* Created using jsbin.com by roXon 29/10/2012
* Source can be edited via http://jsbin.com/uleloy/2/edit
* -->
<head>
<meta charset="utf-8" />
<title>JS Bin</title>
<style id="jsbin-css">
        *{margin:0;padding:0;}
    .accordion h3{ background:#eee; padding:10px; }
    .accordion div{ background:#999;   }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>

<body>
<div class="accordion">
    <h3>Title 1</h3>
    <div>Content 1...</div>
    <h3>Title 2</h3>
    <div>Content 2...</div>  
    <h3>Title 3</h3>
    <div>Content 3...</div>  
    <h3>Title 4</h3>
    <div>Content 4...</div>  
</div>

<script>
    var $accordionIO = $('.accordion h3');
    $accordionIO.next('div').hide();

    $accordionIO.click(function(){
        $(this).next('div').slideToggle();
    });
</script>

我现在想知道,是否有可能让展开的部分向上扩展到按钮上方,而不是正常情况,它会在按钮下面打开并垂直向下扩展?

0 个答案:

没有答案