问题
I am using jquery accordion on draggable element, after the element dragged, its height is not autoresized when the accordion inside it is collapsed.
What's the problem here?
回答1:
From what I could find this seems to be a recurring issue, the container height won't be set back to 'auto' after dragging.
The 'bug' is apparently a limitation of the CSS spec that Firefox does comply with; quite some details and jsfiddle examples can be found here: http://bugs.jqueryui.com/ticket/10725
My solution so far is to set the height to 'auto' myself when needed:
$('#container').css({height; 'auto'});
Of course this is inelegant, and you have to write it after every dynamic content change in your container. Still it makes your code work until an option is added (follow http://bugs.jqueryui.com/ticket/3011 for that).
Cheers
回答2:
This is working for me:
$('#container').draggable({
stop: function() {
return $(this).css({
height: 'auto'
});
}
});
来源:https://stackoverflow.com/questions/29066514/jquery-accordion-on-draggable-element-height-of-draggable-not-auto-resize