问题
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