Skip to content

Commit

Permalink
fix(core): don't auto create elements on destroy/init
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Sep 8, 2021
1 parent f07d43f commit b4cdea8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/shared/create-element-if-not-defined.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ export default function createElementIfNotDefined(swiper, originalParams, params
if (swiper.params.createElements) {
Object.keys(checkProps).forEach((key) => {
if (!params[key] && params.auto === true) {
const element = document.createElement('div');
element.className = checkProps[key];
swiper.$el.append(element);
let element = swiper.$el.children(`.${checkProps[key]}`)[0];
if (!element) {
element = document.createElement('div');
element.className = checkProps[key];
swiper.$el.append(element);
}
params[key] = element;
originalParams[key] = element;
}
Expand Down

0 comments on commit b4cdea8

Please sign in to comment.