views:

234

answers:

2

hello every one, can anyone please help me, how to resize font size by resize event of div using jquery ui plugin?

html :

<div>my testing data</div>

script :

$('div').resize(); //this function is called from resize plugin of ui jquery

i want to increase font size by resizing the div.

+1  A: 

According to documentation, you can do something like this:

$("#dialog").bind('resize', function(event, ui){
   var height = $(this).dialog('option', 'height');
   $(this).css('font-size', height);
});

Consider your div has anid="dialog".

Hope this helps.

Darmen
Dear bro, this is not working, i have already tried for it
chirag
A: 

@Darmen is right. But, you can simplify the code a little bit by using some of the method overloads. Like the constructor:

$('#dialog').resizable({
    resize: function(event, ui) {
        ui.element.css({'font-size':'20px'});
    }
});
smaglio81
it's a little bit clear, right
Darmen
Yeah, it's clear. I wanted to add that as a comment or your answer; but I can't find the link to do that. The only options I see below your answer are "link" and "flag".
smaglio81
its working fine, i have just make little change in it$('#dialog').resizable({resize: function(event, ui) {var height1 = parseInt(ui.element.css('height'));ui.element.css({'font-size': height1+'px'});}});
chirag