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

406 views Asked by At

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

There are 1 answers

2
Sga On

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