开发者

Multiple buttons in the header

开发者 https://www.devze.com 2023-01-24 22:04 出处:网络
I\'m trying to get the following effect in the jQuery Mobile framework: -------------------------------------------------|

I'm trying to get the following effect in the jQuery Mobile framework:

|-------------------------------------------------|
|[button1]      HeaderText/Image  [b1] [b2] [b3]  |
|---------------------开发者_如何学Go----------------------------|

Where [b1], [b2] and [b3] are small image buttons in the Header.

Is this even possible currently?


just simple like this

<div class="ui-btn-right">
    <a href="index.html" data-role="button" data-iconpos="notext"></a>
    <a href="index.html" data-role="button" data-iconpos="notext"></a>
    <a href="index.html" data-role="button" data-iconpos="notext"></a>
</div>


I have had troubles with this in the past. Trick is, force all of your links to be data-role="button" and wrap said links in a container with class="ui-btn-[left/right]" (respectively) This takes care of the traditional header button positioning and markup.

<div data-role="header">
    <div class="ui-btn-left">
        <a href="#" data-role="button">Button1</a>
    </div>
    <h1>HeaderText/Image</h1>
    <div class="ui-btn-right">
        <a href="#" data-role="button" data-icon="gear" data-iconpos="notext">B1</a>
        <a href="#" data-role="button" data-icon="gear" data-iconpos="notext">B2</a>
        <a href="#" data-role="button" data-icon="gear" data-iconpos="notext">B3</a>
    </div>
</div>


Seems as if it is possible, check out this link:

Grouped buttons on the jQuerymobile Framework website.


This is how i did it. Some of the styling may not be necessary as the class used on the parent div should be enough.

<div data-type="horizontal" style="top:10px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right"> 
        <a href="index.html" data-role="button" data-icon="settings" data-ajax="false">Team Call</a>
        <a href="index.html" data-role="button" data-icon="delete" data-ajax="false">Logout</a> 
    </div>


In order to use your own image buttons on the right side you'll need to either float or position a div to the right, then add your buttons.

Then you'll need to override the jQuery mobile styles for those specific buttons to prevent them from getting the rounded, gradient button style that's automatically added by the library.

#header {
    float: right;
}

#header .ui-btn-up-b,
#header .ui-btn-hover-b, 
#header .ui-btn-down-b 
#header .ui-btn-active { 
    border: 0px; 
    background: none;  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消