English 中文(简体)
j 协议: 标题点击上的明显扩展,指定连接
原标题:jQuery Accordion: Disable expand on header click, assign to link

是否有办法从头盔点击中解开小节,而是将功能分配给头盔中的一个环节? 想法是,在船长左边有一个 but子,使船长扩大和倒塌。 我希望,这将使我能够把其他内容列入标题,在不扩大/拉皮条的情况下可以点击。 感谢!

最佳回答

Here是这样做的一种方式。 基本上,与<代码>可处理备选办法和具有约束力的<代码>click/ > 代码” 最初促成协议的活动,然后是礼让,最后是不能兼容的。

HTML:

<div class="demo">
  <div id="accordion">
    <h3>
        <a href="#">Section 1</a>
        <a href="#" data-index="0" class="trigger">Expand this</a>
    </h3>
    <div>
      <p>
        Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
        amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo
        ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
      </p>
    </div>
    <h3>
        <a href="#">Section 2</a>
        <a href="#" data-index="1" class="trigger">Expand this</a>
    </h3>
    <div>
      <p>
        Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
        purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
        velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit
        faucibus urna.
      </p>
    </div>
    <h3>
        <a href="#">Section 3</a>
        <a href="#" data-index="2" class="trigger">Expand this</a>
    </h3>
    <div>
      <p>
        Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
        Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
        ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia
        ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
      </p>
      <ul>
        <li>
          List item one
        </li>
        <li>
          List item two
        </li>
        <li>
          List item three
        </li>
      </ul>
    </div>
    <h3>
        <a href="#">Section 4</a>
        <a href="#" data-index="3" class="trigger">Expand this</a>
    </h3>
    <div>
      <p>
        Cras dictum. Pellentesque habitant morbi tristique senectus et netus et
        malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus
        orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel
        est.
      </p>
      <p>
        Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
        Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
        inceptos himenaeos.
      </p>
    </div>
  </div>
</div>

Javascript:

$(function() {
    $("#accordion").accordion({ disabled: true });
    $(".trigger").click(function() {
        $("#accordion").accordion("enable").accordion("activate", parseInt($(this).data("index"), 10)).accordion("disable");
    });
});
问题回答

http://jqueryui.com/demos/accordion/#option-header”rel=“nofollow”

$( ".selector" ).accordion({ header:  h3  });

A better way is to unbind the click handler:

    $(function () {
      $("#accordionId").accordion({
         collapsible: true,
         active: false,
         animate: 0,
         icons: false
      });

      $(".ui-accordion-header").unbind( click ).click(function() {
         alert( dsds );
      });
   });

As above.
If you are only using one accordion or having the same functionality/interface I would usually edit the actual java script file

eg. jquery.accordion

I would edit the default settings near the bottom of the file from header: "a" to something like header: "acc-heading"

海事组织最可取的方式是将活动安排在none<>em>时,同时启动协议:

$("#accordion").accordion({
  event: "none"
});

之后,人们能够从法典中引开这一节:

$("#accordion").accordion("option", "active", 0);

https://jsfiddle.net/pzwj849m/"rel=“nofollow noreferer”>JSFiddle example

请注意,如果你使用旧的jq-ui版本的话,你可能需要使用旧方法——活性/m>。 (而不是option”,“active”





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!