jQuery Mobile提供了以下可折叠内容。如何才能阻止标题缩短?
目前,文本被剪掉了,所以读起来像"标题很长…"我需要用css手动做这件事吗?或者我可以更改JQB设置吗?
<div data-role="collapsible">
<h4>
Really long heading goes here thats wider than the page width
</h4>
<p>
Content Content Content Content Content Content
</p>
</div>
这是文件http://jquerymobile.com/test/docs/content/content-collapsible.html
似乎是这个CSS导致了这种行为。如果没有标准的JQM方法,我可以覆盖这个规则。
.ui-btn内部{空白:nowrap;}
您需要删除此css:
white-space: nowrap;
从其内部跨度(跨度换行符的文本)。或者替换为:
white-space: normal;
或者更改jQM-css文件(.ui-btn-inner),但这也会影响使用此类的其他元素。
或者使用以下行:
$('div[data-role="collapsible"] h4 a span span.ui-btn-text').css({'white-space':'normal'});
没有其他方法,或者至少不购买更改一些jQM UI元素属性。