在jQuery Mobile中,如何在固定标头的右上角做一个Flipswitch? [英] How do you make a flipswitch on the right corner of a fixed header in jQuery Mobile?

查看:123
本文介绍了在jQuery Mobile中,如何在固定标头的右上角做一个Flipswitch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下操作:

<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>

,但它在h1

推荐答案

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

JSFiddle

这篇关于在jQuery Mobile中,如何在固定标头的右上角做一个Flipswitch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆