jquery accordion on draggable element, height of draggable not auto resize

柔情痞子 提交于 2020-01-03 06:04:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!