Jquery Mobile Collapsible Content [duplicate]

流过昼夜 提交于 2019-12-24 12:17:57

问题


Possible Duplicate:
Dynamically adding collapsible elements

I would like to use the Jquery mobile collapsible content i.e., Accordion functionality in one of my requirement. when I am trying to use the collapsible content set as mentioned below

<div data-role="collapsible" data-collapsed="false">
<h3>Section A</h3>
<p>I'm the collapsible set content for section B.</p>
</div>

<div data-role="collapsible">
<h3>Section B</h3>
<p>I'm the collapsible set content for section B.</p>
</div>

and imported jquery.mobile-1.0b2.min.css,jquery-1.6.2.min.js,jquery.mobile-1.0b2.min.js

I just wanted to use the collapsing and expanding functionality of the accordion. But when I use the above content its changing the entire page layout by adding the css of jquery mobile which is not required for me.

Also I have few more links on the page which will redirect me to different pages but after including the jquery mobile CSS if I click on those links it opens the page below the existing page.

I would like to know is there any jquery mobile plugin such that I can use only the functionality of accordion and ignoring the other functionalities?


回答1:


You'll have to use some of the global configuration settings described here.

For example to avoid the autoinit, setting autoInitializePage to false will prevent the auto initialization of the page. Settign the ajaxEnabled setting to false might deal with your link problem, but I'm not sure about that.

To initialize your div correctly after preventing the default init formating, you'll have to use something like $("a way to select your div").trigger('create'); as specified here



来源:https://stackoverflow.com/questions/7226788/jquery-mobile-collapsible-content

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