Reputation: 10936
I am using jquery resizable
to resize a div
$( "div" ).resizable();
I have one section and a div
inside it with scrollable content. I am facing couple of problems.
How it is possible with jquery ui resizable, or there any plugin other than this that can do this job.
Fiddle: http://jsfiddle.net/k6r5P/
Upvotes: 2
Views: 843
Reputation: 6344
For resizing the div in the y axis only. You could also remove the if
condition if you like
Try
$( ".contenteditable" ).resizable({
create:function(event,ui){//for setting overflow
if($(this)[0].scrollHeight > parseInt($(this).css('height'),10)){
$('.contenteditable').css('overflow','auto');
}
},
resize: function(event,ui){ //for restricting x-axis resize
if(ui.size.width>250){
ui.size.width = ui.originalSize.width;
}
}
});
And for moving the resize icon try
$( ".contenteditable" ).scroll(function(e){
var newH = $(this).scrollTop() + parseInt($(this).css('height'),10);
if(newH > $(this)[0].scrollHeight){
newH = $(this)[0].scrollHeight;
}
$(this).css('height',newH+'px');
});
Demo here
Upvotes: 1