2012-02-06 103 views
0

你很簡單,我在互聯網上搜索了這個,我無法想出一個解決方案。我相信解決方案必須非常簡單,但無論如何,這是問題所在。jQuery Mobile元素尺寸

我用jQueryMobile製作了一個移動網絡(確實是一個本地應用程序的webView),而且一切看起來都很大。我試過我可以使用style =「width:xx」來設置按鈕的寬度,但高度呢?總體尺寸一般。

比如,頁眉填滿了我頁面的四分之一。

由於

回答

0

直播示例:

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%'); 

UPDATE: (我認爲這是你在找什麼)

// 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> 

相關:

+0

感謝。我在原帖中看到了這個答案。我認爲會有一個更簡單的方法來做到這一點。但是,謝謝,這有幫助。 – AbSoLution8 2012-02-06 05:15:11

+0

jQM增加了許多額外的HTML,使它具有跨多個設備的外觀和感覺,恕我直言,最好使用諸如Chrome開發工具或Firebug之類的東西,並查看添加的HTML元素,找到操縱這種方式所需的元素。 – 2012-02-06 14:12:35