我正在尝试向标头添加开关。它工作正常,但开关在下一行,我希望它在标题右侧
代码:
<div data-role="page" id="moreevents">
<div data-role="header" data-position="fixed">
<a href="#defaultclub" data-icon="arrow-l" data-theme="b" onclick="getClubData(curClub)" id="backtoclub">Back</a>
<h1>All Events</h1>
<div align="right">
<select name="switch" id="alleventsswitch" data-role="slider">
<option value="off">No Past</option>
<option value="on">Past</option>
</select>
</div>
</div>
</div>
工作示例:
答案 0 :(得分:1)
点击此处DEMO http://jsfiddle.net/yeyene/Y9ntF/1/
您需要减少默认h1
宽度和边距,以便为switch
提供空间。
<div data-role="page" id="moreevents">
<div data-role="header" data-position="fixed">
<a href="#defaultclub" data-icon="arrow-l" data-theme="b" onclick="getClubData(curClub)" id="backtoclub">Back</a>
<h1 id="myTitle">All Events</h1>
<span id="mySelect">
<select name="switch" id="alleventsswitch" data-role="slider">
<option value="off">No Past</option>
<option value="on">Past</option>
</select>
</span>
</div>
</div>
#myTitle{
float:left;
width:20%;
margin: .6em 0 .8em 40%;
}
#mySelect{
float:right;
z-index: 1;
}