3

私はブートストラップ/html に基づいて管理パネルを購入しました。これには多くの優れた機能が付属しており、そのうちの 1 つは非常に洗練されたフリップ スイッチであり、それを任意の製品のステータスに使用したいと考えています。

実際のコードはこんな感じ

<div data-off-label="Disabled"  data-on-label="Enabled"  class="switch" style="margin-top:12px;">
<input type="checkbox" checked="checked">                                       
</div>

ブラウズから要素を調べると、次のようになります。

<div data-off-label="Disabled" data-on-label="Enabled" class="switch" style="margin-top:12px;">
<div class="switch-on switch-animate" style="">
    <input type="checkbox" checked="checked">
    <span class="switch-left">Enabled</span><label>&nbsp;
    </label><span class="switch-right">Disabled</span>
</div>

通常の data-role="flipswitch" を使用しましたが、これは次のように異なります

スイッチオンはこんな感じ

<div class="switch-on switch-animate"> 

スイッチオフはこんな感じ

<div class="switch-off switch animate">

上記を使用して、データベースからの値に応じてページが読み込まれるタイミングを変更する方法を教えてください。

私は以下を試しましたが、うまくいきませんでした

<div data-off-label="Disabled" data-on-label="Enabled" class="switch" style="margin-top:12px;">
<div class="<?if($Status = 1){ echo 'switch-on'; } else { echo 'switch-off'; } switch-animate" style="">
    <input type="checkbox" checked="checked">
    <span class="switch-left">Enabled</span><label>&nbsp;
    </label><span class="switch-right">Disabled</span>
</div>

そして、スイッチがうまく作動せず、スムーズにスライドしなくなります。

助けてくれてありがとう

========= 管理パネルの開発者がこのモジュールをスイッチに使用したようです

http://www.bootstrap-switch.org/documentation-2.html

ですから、誰かがこれについて私を助けることができれば、本当に感謝しています。私は今何時間も立ち往生しています:(

4

1 に答える 1