jqueryui手风琴普通链接

jqueryui手风琴普通链接,jquery,jquery-ui,accordion,Jquery,Jquery Ui,Accordion,我正在使用jQueryUIaccordion()。我有4个标签。我想做两个滑动,这是手风琴的工作方式,另外两个只是正常的链接没有滑动。我不知道如何进行正常链接,因为accordion希望在标记之后有一个元素作为内容 <div id="test"> <h3><a href="#">One</a></h3> <div> some text </div> <h3&g

我正在使用jQueryUI
accordion()
。我有4个标签。我想做两个滑动,这是手风琴的工作方式,另外两个只是正常的链接没有滑动。我不知道如何进行正常链接,因为accordion希望在
标记之后有一个元素作为内容

<div id="test">
    <h3><a href="#">One</a></h3>
    <div>
        some text
    </div>
    <h3><a href="#">Two</a></h3>
    <div>
        some text
    </div>
    <h3><a href="whatever.html">Link</a></h3>
    <h3><a href="whatever1.html">Link</a></h3>
</div>

一些文本
一些文本

查看手风琴的演奏方法(http://jqueryui.com/demos/accordion/),我不认识任何锁定不可处罚物品的东西

你为什么不直接坐飞机呢

 <h3><a href="whatever.html">Link</a></h3>
<h3><a href="whatever1.html">Link</a></h3>


你可以在这里看到:


您仍然需要使用CSS对其进行蒙皮,尽管查看手风琴方法(http://jqueryui.com/demos/accordion/),我不认识任何锁定不可处罚物品的东西

你为什么不直接坐飞机呢

 <h3><a href="whatever.html">Link</a></h3>
<h3><a href="whatever1.html">Link</a></h3>


你可以在这里看到:


您仍然需要使用CSS对其进行蒙皮,不过您可以通过
jquery
更改最后两个选项卡上的单击:

$('h3 span').slice(2) // accordion adds a span to put the triangle icon
                      // deactivate the click on it
                      // slice(2) to take last 2 tabs
            .click(function(){
    return false;     // deactivate the click
});

$('h3 a').slice(2).click(function(){
    location.href = $(this).attr('href'); // redirect the page to
                                          // the href of current anchor
    return false;                         // deactivate the click
});

jsiddle:您可以通过
jquery
更改最后两个选项卡上的单击:

$('h3 span').slice(2) // accordion adds a span to put the triangle icon
                      // deactivate the click on it
                      // slice(2) to take last 2 tabs
            .click(function(){
    return false;     // deactivate the click
});

$('h3 a').slice(2).click(function(){
    location.href = $(this).attr('href'); // redirect the page to
                                          // the href of current anchor
    return false;                         // deactivate the click
});

jsfiddle:我想你应该把手风琴的链接取出来:

<div id="textParent">
    <div id="test">
        <h3><a href="#">One</a></h3>
        <div>
            Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        </div>
        <h3><a href="#">Two</a></h3>
        <div>
            Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        </div>
    </div>
    <h3><a href="whatever.html">Three</a></h3>
    <h3><a href="whatever1.html">Four</a></h3>
</div>

莫里斯·莫里斯·安特、布兰迪·埃特、奥特莱斯a、苏西比特·埃特、夸姆。整数
莫里斯·莫里斯·安特、布兰迪·埃特、奥特莱斯a、苏西比特·埃特、夸姆。整数

希望这有帮助。干杯

我想你应该把手风琴的链接拿出来:

<div id="textParent">
    <div id="test">
        <h3><a href="#">One</a></h3>
        <div>
            Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        </div>
        <h3><a href="#">Two</a></h3>
        <div>
            Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        </div>
    </div>
    <h3><a href="whatever.html">Three</a></h3>
    <h3><a href="whatever1.html">Four</a></h3>
</div>

莫里斯·莫里斯·安特、布兰迪·埃特、奥特莱斯a、苏西比特·埃特、夸姆。整数
莫里斯·莫里斯·安特、布兰迪·埃特、奥特莱斯a、苏西比特·埃特、夸姆。整数

希望这有帮助。干杯花了我几天时间,但我终于找到了答案

按照文档中的建议构建手风琴,标题下方有空div,没有子条目。然后你需要这两个函数

//make links work in accordion headers
$("#accordion h3 a").click(function() {
    window.location = "default.html"+$(this).attr('href');
    window.location.reload();
    return false;
});

//cycle through each header, checking if the next div has html and remove ui-icon class if it doesn't
$("#accordion h3").each(function(index) {
    if ($(this).next("div").html() == "") {
        $(this).children("span").removeClass("ui-icon");
    }
});

我花了几天时间,但我终于找到了答案

按照文档中的建议构建手风琴,标题下方有空div,没有子条目。然后你需要这两个函数

//make links work in accordion headers
$("#accordion h3 a").click(function() {
    window.location = "default.html"+$(this).attr('href');
    window.location.reload();
    return false;
});

//cycle through each header, checking if the next div has html and remove ui-icon class if it doesn't
$("#accordion h3").each(function(index) {
    if ($(this).next("div").html() == "") {
        $(this).children("span").removeClass("ui-icon");
    }
});

将链接放在手风琴外,并对其应用相同的样式将链接放在手风琴外,并对其应用相同的样式谢谢,但对于我想做的事情来说,代码有点太多了+谢谢你,它正好解决了我的问题。我有一长串没有孩子的物品。我需要那些没有孩子的人保持联系。令人惊叹的谢谢,但是对于我想做的事情来说,代码有点太多了+谢谢你,它正好解决了我的问题。我有一长串没有孩子的物品。我需要那些没有孩子的人保持联系。令人惊叹的