1
我希望文本保持在一行內,所以我希望它在變小時溢出。如何使文本在溢出時變小
我不要使用ellipsis
像答案
他(How can I make text get smaller in order to stay on one line?)獲得。
我希望文本保持在一行內,所以我希望它在變小時溢出。如何使文本在溢出時變小
我不要使用ellipsis
像答案
他(How can I make text get smaller in order to stay on one line?)獲得。
$(document).ready(function()
{
$('#button').click(function()
{
var current_size = $('#content_to_be_resized').css('font-size');
var new_size = parseFloat(current_size) - 3;
$('#content_to_be_resized').animate({fontSize: new_size}, 250);
});
});
假如你點擊一個按鈕,你得到你的文字電流的大小,你讓使用它實際上解析一個字符串並返回一個浮點數parseFloat新的大小,所以在20像素 - parseFloat()將返回20.