我在同一容器内有一个Map和一个List,设置了2:5的弹性比。我希望能够在地图上切换双击以最大化它以填充容器或将其重置回原始大小,具体取决于列表是否被隐藏。我编写了下面的函数并将其绑定到map的dblclick事件。我看到它进入这个功能,但它对我所看到的没有影响。我的列表为什么不能动画和隐藏任何想法?
google.maps.event.addListener(that.getMap(), 'dblclick', function () {
var list = Ext.ComponentQuery.query('#BuildingList')[0];
var height = list.getHeight();
if (list.isHidden()) {
list.show(Ext.Anim({
easing: 'easeInOut',
duration: 1000,
autoClear: false,
from: {
opacity: 0,
height: '0px'
},
to: {
opacity: 1,
height: list.getHeight() + 'px'
}
}));
} else {
list.hide(Ext.Anim({
easing: 'easeInOut',
duration: 1000,
autoClear: false,
from: {
opacity: 1,
height: list.getHeight() + 'px'
},
to: {
opacity: 0,
height: '0px'
}
}))
}
});
答案 0 :(得分:0)
我发现这种事情的最好方法是将dblclick事件上的flex设置为0(我必须添加为地图的覆盖),如下所示:
that.addAfterListener('dblclick', function (view, map, zoomlevel, eOpts) {
var list = view.getParent().down('buildings');
Ext.Anim.run(list, 'fade', {
easing: 'easeInOut',
autoClear: false,
duration: 300,
after: function () {
list.setFlex(0);
}
});
});