jquery モバイルの基本構造から外れるのが悪い習慣だと思います。私の例では、まったく同じコードが得られました。しかし、他のものでは、タグの前に div を追加しました。cssが正しくないため、別の見方ができます。悪いですか?それは私の見栄えの良いリストを壊します。そして、それの良い解決策はありますか?
理由は、som jQuery で div を表示および非表示にするために、リスト内の情報をある程度制御したいからです。これを簡単に解決して、 li タグにクラスを与え、代わりにそれを非表示にして表示します。しかし、とにかくそれについて少し混乱しています
このコードがある場合 (jquery デモ ページから取得):
<li>
<a href="#">
<h2>
Stephen Weber</h2>
<p>
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
<p>
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
<p class="ui-li-aside">
<strong>6:24</strong>PM</p>
</li>
次の html が生成されます。
<li class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c" data-corners="false"
data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="false"
data-iconpos="right" data-theme="c">
<div class="ui-btn-inner ui-li">
<div class="ui-btn-text">
<p class="ui-li-aside ui-li-desc">
<strong>6:24</strong> PM
</p>
<a class="ui-link-inherit" href="#">
<h2 class="ui-li-heading">
Stephen Weber</h2>
<p class="ui-li-desc">
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong>
</p>
<p class="ui-li-desc">
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
</div>
</div>
</li>
しかし、次のようにコードに div を追加すると:
<li>
**<div>**
<a href="#">
<h2>
Stephen Weber</h2>
<p>
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
<p>
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
<p class="ui-li-aside">
<strong>6:24</strong>PM</p>
</div>
</li>
次の html が生成されます。
<li class="ui-li ui-li-static ui-btn-up-c">
<div>
<p class="ui-li-aside ui-li-desc">
<strong>6:24</strong> PM
</p>
<a class="ui-link" href="#">
<h2 class="ui-li-heading">
Stephen Weber</h2>
<p class="ui-li-desc">
<strong>You've been invited to a meeting at Filament Group in Boston, MA</strong>
</p>
<p class="ui-li-desc">
Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the
jQuery team.</p>
</a>
</div>
</li>