jquery accordion on draggable element, height of d

2019-06-08 17:22发布

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?

2条回答
神经病院院长
2楼-- · 2019-06-08 17:23

This is working for me:

$('#container').draggable({
  stop: function() {
    return $(this).css({
      height: 'auto'
    });
  }
});
查看更多
我想做一个坏孩纸
3楼-- · 2019-06-08 17:25

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

查看更多
登录 后发表回答