How do you make a flipswitch on the right corner of a fixed header in jQuery Mobile?

自古美人都是妖i 提交于 2019-12-11 12:10:37

问题


I have tried the following:

<div data-role="header" data-position="fixed" data-tap-toggle="false">
<h1>My Page</h1>
<label for="nfcSwitch" class="ui-hidden-accessible">NFC:</label>
<input data-role="flipswitch" name="nfcSwitch" id="nfcSwitch" data-on-text="NFC on" data-off-text="NFC off" type="checkbox" />
</div>

but it shows the flipswitch on the left, under the h1


回答1:


HTML

<div data-role="header" data-position="fixed" data-tap-toggle="false">
    <h1>My Page</h1>
    <div class="switch">
        <label for="nfcSwitch" class="ui-hidden-accessible">NFC:</label>
        <input data-role="flipswitch" name="nfcSwitch" id="nfcSwitch" data-on-text="NFC on" data-off-text="NFC off" type="checkbox"/>
    </div>
</div>

CSS

.switch
{
    position: absolute;
    top: 0px;
    right: 0px;
}

JSFiddle



来源:https://stackoverflow.com/questions/25009376/how-do-you-make-a-flipswitch-on-the-right-corner-of-a-fixed-header-in-jquery-mob

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