【问题标题】:jQuery Mobile Element SizesjQuery Mobile 元素大小
【发布时间】:2012-02-06 04:34:19
【问题描述】:

这很简单,我已经在互联网上搜索了这个,但我无法提出解决方案。我相信解决方案一定很简单,但无论如何,问题就在这里。

我用 jQueryMobile 制作了一个移动 web(确实是原生应用程序的 webView),一切似乎都那么大。我试过我可以使用 style="width:xx" 来设置按钮的宽度,但是高度呢?整体尺寸一般。

比如,页眉占了我页面的四分之一。

谢谢

【问题讨论】:

    标签: android jquery-mobile webview


    【解决方案1】:

    现场示例:

    JS:

    // For all buttons use something like this
    $('.ui-btn').css('width','50%');
    
    // For individual buttons use something like this
    $('#theButton1').parent().css('width', '75%');
    
    // Or this for HREF data-role buttons
    $('#hrefButton4').css('width', '45%');
    

    更新:(我认为这就是你要找的)

    // this changes the height for all buttons
    $('.ui-btn-text').css('font-size','50px');
    
    // This changes the height for a single element 
    $('#hrefButton3').children().children().css('font-size','30px');
    

    HTML:

    <div data-role="page" id="home"> 
        <div data-role="content">
            <input type="button" id="theButton1" value="Press Me 1" />
            <input type="button" id="theButton2" value="Press Me 2" />
            <input type="button" id="theButton3" value="Press Me 3" />
            <input type="button" id="theButton4" value="Press Me 4" />
            <br />
            <a href="#" data-role="button" id="hrefButton1">HREF Me 1</a>
            <a href="#" data-role="button" id="hrefButton2">HREF Me 2</a>
            <a href="#" data-role="button" id="hrefButton3">HREF Me 3</a>
            <a href="#" data-role="button" id="hrefButton4">HREF Me 4</a>
        </div>
    </div>
    

    相关:

    【讨论】:

    • 谢谢。我实际上在原始帖子中看到了这个答案。我认为会有一种更简单的方法来做到这一点。不过谢谢,这有帮助。
    • jQM 添加了许多额外的 HTML 以使其具有跨多个设备的外观和感觉,恕我直言,最好使用 Chrome 开发工具或 Firebug 之类的工具并查看添加的 HTML 元素,找到需要的元素以这种方式操作。
    猜你喜欢
    • 2013-07-15
    • 1970-01-01
    • 1970-01-01
    • 2012-05-01
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    相关资源
    最近更新 更多