任何人都可以請幫我,如何使用jQuery UI的插件,通過DIV的調整大小事件調整字體大小?我怎樣才能通過調整使用jQuery在div調整DIV的字體?
HTML:
<div>my testing data</div>
腳本:
$('div').resize(); //this function is called from resize plugin of ui jquery
我想通過調整股利增加字體大小。
任何人都可以請幫我,如何使用jQuery UI的插件,通過DIV的調整大小事件調整字體大小?我怎樣才能通過調整使用jQuery在div調整DIV的字體?
HTML:
<div>my testing data</div>
腳本:
$('div').resize(); //this function is called from resize plugin of ui jquery
我想通過調整股利增加字體大小。
@Darmen是正確的。但是,您可以通過使用某些方法重載來簡化代碼。像構造:
$('#dialog').resizable({
resize: function(event, ui) {
ui.element.css({'font-size':'20px'});
}
});
據documentation,你可以做這樣的事情:
$("#dialog").bind('resize', function(event, ui){
var height = $(this).dialog('option', 'height');
$(this).css('font-size', height);
});
考慮您的div
有id="dialog"
。
希望這會有所幫助。
親愛的兄弟,這是行不通的,我已經嘗試了它 – chirag
再次得到高度訪問「選項」可以使用UI對象,而不是,它會給你開始的大小,最終的大小和位置了。
* ui.helper - a jQuery object containing the helper element
* ui.originalPosition - {top, left} before resizing started
* ui.originalSize - {width, height} before resizing started
* ui.position - {top, left} current position
* ui.size - {width, height} current size
它一點點清晰,正確的 – Darmen
是的,很明顯。我想補充說,作爲評論或你的答案;但我找不到鏈接來做到這一點。我在您的答案下看到的唯一選項是「鏈接」和「標誌」。 – smaglio81
它的做工精細,我剛纔在其中進行 $變化不大( '#對話'),可調整大小({ 調整大小:函數(事件,UI){VAR height1 = parseInt函數(ui.element.css(」高度 ')); ui.element.css({' 字體尺寸 ':height1 +' 像素'});} }); – chirag