jQuery .html(数据在这里)似乎“重新调整大小”回复文本

StackOverflow https://stackoverflow.com/questions/1404676

  •  05-07-2019
  •  | 
  •  

请考虑以下代码。

这是一个带有名为 leader-module-total 的id的锚标记 - 按下时 - 调用PHP脚本并在名为 leader-的id中显示PHP代码中完成的回声模块

足够基本。

然而,每次我这样做,我都需要“收缩”。它使用此代码段中的最后一段代码。

我的问题是,为什么?我在这里做错了吗?

$('#leader-module-total').click(function() {

   //load an image to show while processing
   $('#leader-module').html( '<div class="ajaxLoader"></div>' );

   //process the php script -- btw, is this valid i.e. calling it using / 
   //and not fully qualified with http://mydomain/page-to-be-called  
   $.get('/ajax-leader-module-response.php', { timeframe: 'total' }, 
       function(data){
          $('#leader-module').html( data );
       }
   );

   //this is my question: why is this necessary???  
   //I need to make it smaller than it was for it to display normally.
   $('#leader-module').css('font-size', '0.9333em');
   return false;
});
有帮助吗?

解决方案

我认为它是从父标记继承样式。请检查父元素是否有任何字体大小样式。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top