[英]How to change text size with radio button - JQuery Mobile
我正在嘗試更新列表視圖中每個項目的標題和段落信息的文本大小。 這是我到目前為止擁有的JQuery:
$('#rc1').prop('checked', 'true', function(){
$(".feedContainer ul li h3").css('font-size', '1em');
$(".feedContainer ul li p").css('font-size', '.9em');
});
$('#rc2').prop('checked', 'true', function(){
$(".feedContainer ul li h3").css('font-size', '1.5em');
$(".feedContainer ul li p").css('font-size', '1.4em');
$('#header-title').html('test');
});
$('#rc3').prop('checked', 'true', function(){
$(".feedContainer ul li h3").css('font-size', '2em');
$(".feedContainer ul li p").css('font-size', '1.9em');
});
這是html:
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
<legend>Text Size</legend>
<input type="radio" name="rc1" id="rc1" value="off" >
<label for="rc1">A</label>
<input type="radio" name="rc2" id="rc2" value="off">
<label for="rc2">A</label>
<input type="radio" name="rc3" id="rc3" value="off">
<label for="rc3">A</label>
</fieldset>
以及單選按鈕組中字母“ A”大小的CSS(同樣不起作用):
#rc1 {
font-size: 12px;
}
#rc2 {
font-size: 16px;
}
#rc3 {
font-size: 24px;
}
有人可以幫我嗎? 謝謝!
編輯:為feedContainer添加了CSS:
.feedContainer ul li h3 {
color: #333;
font-size: 1em;
padding: 0;
font-weight: bold;
margin: 0;
font-family: 'Oxygen', sans-serif;
white-space:normal;
}
.feedContainer ul li p {
font-size: .9em;
color: #666;
margin: 0;
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
white-space:normal;
}
jQuery .class選擇器選擇classname為.class的所有元素,像這樣嘗試一下,看看var是什么
var color = $("div").css( "background-color" );
.feedContainer是元素嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.