I want to be able to drag a divider up and down to resize the divs above and below the divider on a fixed page height. These divs could be in a table, although they need not be.
In short, I would like to be able to emulate what happens on the jsFiddle site, although I only need the vertical resize. jsFiddle have used mooTools, but I want to do it with jQuery.
One important complication: I won't know the size of the div above the divider until it is actually built dynamically, so I can't just start with a set absolute positioning.
What is the best way forward? I have a feeling I'll just be reinventing the wheel if I don't ask :)
[BTW: a couple of questions with similar names are linked to jsFiddle examples that don't work (for example, this).
So far I have used this:
$('.rsh').draggable({
axis:'y',
drag: function (event, ui) {
var offsettop = ui.offset.top;
$(this).prev().css({
height: offsettop
});
});
Needless to say, it ain't workin' right yet.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…