我想在我的項目中使用packery jquery pluging。一切工作正常,但我需要刪除打包只有當我點擊右上角的最小化按鈕。我怎麼能做到這一點,請幫助我的朋友。如何通過點擊按鈕刪除packery
這裏是我的代碼
<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();
});
}
};
}]);
感謝
請提供您的代碼,您使用jquery或vanilla js? – daremachine
感謝您的回覆,我使用jquery – stackoverflow
請提供您的代碼。你已經試過 – vel