Is there a way to resize a div to smaller than the declared height and width?
I\'m making an application where the user can resize a div and save it. However, when I loa
In javascript usign jquery:
//get the current heigt and the width of the element
var h = $('.cls').height();
var w = $('.cls').width();
// i don'T know how you provide your nes size, but once you have in i a variable, you can just do
if(your_h > h) $('.cls').height(your_h);
if(your_w > w) $('.cls').width(your_w);
assuming you size are in PX.
Height() and width() will return the size in px if not arguments are specified. They will set the height and width if you provide a value. If you don't explicitly specify a mesurment, px are used by default.
On the second part, it simply check if the new size (your_x) is biggre than the originla size, if so, it will resize it, if not it will jut ignore.
AND YES, jquery will overwide your css specification ;) anyone, biger or smaller values