Skip to content

Commit ec8be5d

Browse files
committed
Materialbox destroy now removes wrapper element added during init
1 parent c72138e commit ec8be5d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

js/materialbox.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@
7575
destroy() {
7676
this._removeEventHandlers();
7777
this.el.M_Materialbox = undefined;
78+
79+
// Unwrap image
80+
$(this.placeholder)
81+
.after(this.el)
82+
.remove();
83+
84+
this.$el.removeAttr('style');
7885
}
7986

8087
/**
@@ -227,7 +234,7 @@
227234
}
228235

229236
this.$el.removeAttr('style');
230-
this.$el.attr('style', this.originInlineStyles);
237+
this.originInlineStyles && this.$el.attr('style', this.originInlineStyles);
231238

232239
// Remove class
233240
this.$el.removeClass('active');

0 commit comments

Comments
 (0)