如何使用jquery动态增加flie中数据的字体大小?
我已经动态创建了listview。在listview中有很多项。每个项目都有自己的文件。当我单击特定项目时,特定文件数据显示在动态创建的页面中 用于显示文件数据的动态页面:如何使用jquery动态增加flie中数据的字体大小?,jquery,listview,font-size,Jquery,Listview,Font Size,我已经动态创建了listview。在listview中有很多项。每个项目都有自己的文件。当我单击特定项目时,特定文件数据显示在动态创建的页面中 用于显示文件数据的动态页面: $($.mobile.pageContainer).append(' <div data-role="page" id="' + seq + '" class="items"> <div data-role="content" id="desc"></div>
$($.mobile.pageContainer).append('
<div data-role="page" id="' + seq + '" class="items">
<div data-role="content" id="desc"></div>
<div data-role="footer" data-position="fixed" class="my-footer">
<div data-role="popup" id="textMenu" style="margin-bottom:10px;">
<ul id="pageSize" data-role="listview" data-inset="true" data-theme="a">
<li data-icon="false"><a href="" id="textSize">Text size</a></li>
</ul>
</div>
<div class="ui-block-a ui-bar-a" data-theme="a">
<div align="left" style="padding-left:5px;padding-top:3px;height:33px;height:40px;">
<a href="#textMenu" class="ui-btn-left" data-icon="bars" data-role="button" data-iconpos="notext" data-rel="popup" data-transition="pop"></a>
</div>
</div>
<a href="" data-role="button" class="addToFavoritesDiv">Bookmark</a>
<a href="" data-role="button" class="shareDiv">Share</a>
<div class="ui-block-c ui-bar-a">
<div align="right" style="padding-top:3px;height:33px;height:40px;">
<a href="#" class="ui-btn-right" data-role="button" data-icon="back" data-rel="back" data-iconpos="notext"></a>
</div>
</div>
</div>
</div>');
$('[data-role=page]#' + seq + ' [data-role=content]').load(file);
提前感谢。这可能会帮助您:
$('*').filter(function() {
return $(this).css('font-size',newFontSize);
});
我找到了调整文本大小的解决方案
$(document).on('click', '#pagesize #textSize', function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$('html').css('font-size', newFontSize);
return false;
});
你有解决办法吗?似乎您指的是动态单击事件。所以像这样
$(“#textSize”).on('click',function(){
$('htm').css('font-size'))不选择任何内容。尝试使用filter()函数。@user1671639不。我也像这样尝试过,但什么都没有发生。我不知道如何更改文件中数据的字体大小。但我尝试过的内容已经发布了代码$(“#textSize”).on('click',function()){var currentFontSize=$('html').css('font-size');var currentFontSizeNum=parseFloat(currentFontSize,10);var newFontSizeNum=currentFontSizeNum*1.2;$('desc').filter(function(){return return$(this).css('font-size',newFontSize);});});将$('html').css('font-size');替换为$('font-size');为$('*')).filter(function(){return return$(this.)('font-size','1.2em');});是的,我也这么做了,你可以看到上面的评论,但不起作用
$(document).on('click', '#pagesize #textSize', function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$('html').css('font-size', newFontSize);
return false;
});