jQuery Mobile Custom download of collapsible set not working/triggering on load?

三世轮回 提交于 2019-12-14 02:36:58

问题


Hi I am new to jquery mobile so forgive me if this is a stupid question.

I'm trying to implement a collapsible set on my page. I have downloaded a custom file from the jquery mobile website using the download builder and just choosing the collapsible set widget, which automatically selects what I assume are the necessary functions to include.

I've followed the instructions on the getting started guide, linked the css files and the custom js file which do load I've checked with firebug.

I've added the appropriate html markup but it fails to do anything when the page loads.

If I try using the entire Jquery mobile v.1.45 file then the collapsable set works but it starts altering other elements on my page like form buttons among other things, messing with my design. As you can understand I don't want it doing that.

I've built my website using drupal I don't know if that matters.

Has anyone else experienced this, is this a bug, is there a work around, am I doing something drastically wrong?

Any help or suggestions would be appreciated.

My mark up is simply:

<div class="ui-collapsible-set field-items" data-corners="false" data-content-theme="a" data-theme="a" data-role="collapsibleset">

  <div class="field-item even" data-role="collapsible">
    <h2>Heading:</h2>
    <p> my text </p>
  </div>

  <div class="field-item even" data-role="collapsible">
    <h2>Heading:</h2>
    <p> my text </p>
  </div>

  <div class="field-item even" data-role="collapsible">
    <h2>Heading:</h2>
    <p> my text </p>
  </div>

</div>

回答1:


Since it's not a full version, then any widget won't be initialized automatically. Therefore, you need to initialize custom widgets manually.

$(function() {
  $("#collapssible-set-ID").collapsibleset();
});


来源:https://stackoverflow.com/questions/31840510/jquery-mobile-custom-download-of-collapsible-set-not-working-triggering-on-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!