开发者

Problems while using icon only with no text in a navbar in jquery mobile footer

This is the code i am using:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name="viewport" content="width=device-width; initial-scale=1.0" />
        <link rel="stylesheet"  href="http://code.jquery.com/mobile/1.0b1/开发者_StackOverflow社区jquery.mobile-1.0b1.min.css" /> 
        <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script> 
        <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
    </head>
    <body>
    <div data-role="page" id="home">
            <div data-role="header" data-theme="b">
                <h1>Home</h1>
            </div>
            <div data-role="content" data-theme="b">
            </div>
             <div data-role="footer" data-position="fixed" data-id="pFooter">
                <div data-role="navbar">
                    <ul>
                        <li><a href="#" data-icon="custom" class="ui-btn-active" >Home</a></li>
                        <li><a href="#first" data-icon="grid">Page1</a></li>
                        <li><a href="#" data-icon="star">Page2</a></li>
                        <li><a href="#" data-icon="arrow-r" data-iconpos="notext"></a></li>
                    </ul>
                </div>
        </div>  
    </div>
    </body>
</html>

You can see it in action here- http://jsfiddle.net/PJWQr/

The problem I am facing is that in the last button where I am using data-iconpos="notext",the height of the interactive area is lesser than other buttons in the navbar.

Kindly let me know how to fix this.


You actually don't need the iconpos="notext" as it is not technically a button.

Remove that attribute and add a space character to the content of the a element:

<li><a href="#" data-icon="arrow-r">&nbsp;</a></li>


Probably the easy (kind of quick and dirty, but I'm heading to bed so this is what you get ;) is to just but a character there: http://jsfiddle.net/PJWQr/2/


<a id="xyz" data-icon="grid" href="#" data-iconpos="notext">&nbsp;</a>

you can use this to avoid extra spaces in a button.


You can do this to remove the disc... for anyone looking for this in the future. Add this to your button element:

data-iconshadow="false"


Your anchor tag needs to contain some sort of text for assistive technologies such as screen readers. A &nbsp; is not enough. You have a few options:

Include some plain old text:

<li><a href="#" data-icon="arrow-r">Next</a></li>

Use aria-label:

<li><a href="#" data-icon="arrow-r" aria-label="Next">&nbsp;</a></li>

Use something like Bootstrap's sr-only CSS class:

<li><a href="#" data-icon="arrow-r"><span class="sr-only">Next</span></a></li>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜