我正在尝试使用Packery jQuery插入我的项目。一切正常,但是只有在我单击右上角最小化按钮时,我才需要删除包装。我该怎么做,请帮助我的朋友。
这是我的代码
<div class="packery" >
<div class="module-sizer"></div>
<div class="gutter-sizer"></div>
<div class="module">
<remove headertitle="Mine"></remove>
</div>
<div class="module" >
<remove headertitle="team lead"></remove>
</div>
</div>
JS代码
app.directive('packery', ['$rootScope', function($rootScope) {
return {
constrain: 'A',
link: function(scope, element, attrs) {
element.ready(function() {
var packery = new Packery(element[0], {
rowHeight: '.module-sizer',
itemSelector: '.module',
columnWidth: '.module-sizer'
});
//this part is for remove
//this should be done only on button click
var packerys = $('.packery').packery();
packerys.on( 'click', function( event ) {
packerys.packery( 'remove', event.target );
packerys.packery();
});
angular.forEach(packery.getItemElements(), function(item) {
var draggable = new Draggabilly(item);
packery.bindDraggabillyEvents(draggable);
});
packery.layout();
});
}
};
}]);
谢谢
您可能想要销毁方法。