我正在尝试使用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 code
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();
});
}
};
}]);
感谢