在collapsible-set(JQuery Mobile)中添加“拆分按钮”

时间:2013-01-24 12:44:16

标签: jquery-mobile

是否有任何方法可以将拆分按钮(ListView附带)添加到可折叠按钮;我已经尝试/测试了下面的代码,但是不起作用!

    <div data-role="collapsible-set" data-theme="a" data-content-theme="e"  data-split-icon="gear" data-split-theme="e">

<div data-role="collapsible">      

<h3> Breakfast </h3>

<p>
<a href="somthing.html"> the contents comes here. 
</a>
</p>

<a href="#purchase" data-rel="popup" data-position-to="window" data-transition="pop">
split button 2
</a>
</div>


<div data-role="collapsible">      

<h3> Lunch</h3>

<p>
<a href="somthingElse.html"> the contents comes here. 
</a>
</p>

<a href="#purchase" data-rel="popup" data-position-to="window" data-transition="pop">
split button 2
</a>
</div>


</div>

非常欢迎任何想法或任何其他解决方案(变通方法)。

1 个答案:

答案 0 :(得分:3)

嗯,它需要一点工作,但这就是我所拥有的

直播示例:

JS

$(".splitButtonClicked").on("click", function (event, ui) {
    alert('Hello');
    return false; // stop collapsible event
});

HTML

<div data-role="page" id="home">
    <div data-role="content">
        <div data-role="collapsible-set" data-theme="b" data-content-theme="d">
            <div data-role="collapsible">
                <h2>
                    <ul data-role="listview" data-split-icon="gear" data-split-theme="d">
                        <li><a href="#">
                            <h3>Breakfast</h3>
                        </a><a href="#breakfast_menu" data-rel="popup" data-position-to="window" data-transition="pop" class="splitButtonClicked">View Menu</a>
                        </li>
                    </ul>
                </h2>
            </div>
            <div data-role="collapsible">
                <h2>
                    <ul data-role="listview" data-split-icon="gear" data-split-theme="d">
                        <li><a href="#">
                            <h3>Lunch</h3>
                        </a><a href="#lunch_menu" data-rel="popup" data-position-to="window" data-transition="pop" class="splitButtonClicked">View Menu</a>
                        </li>
                    </ul>
                </h2>
            </div>
        </div>
    </div>
</div>

希望这有助于你