Skip to content

Commit

Permalink
Merge pull request #7 from oceanwp/rc-2.0.8
Browse files Browse the repository at this point in the history
Rc 2.0.8
  • Loading branch information
eramits authored Nov 13, 2024
2 parents 4a43bee + 90d6e4d commit 60ca939
Show file tree
Hide file tree
Showing 14 changed files with 832 additions and 146 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

**Contributors:** Nick
**Requires at least:** WordPress 5.6
**Tested up to:** WordPress 6.5.3
**Stable tag:** 2.0.7
**Tested up to:** WordPress 6.7
**Stable tag:** 2.0.8
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down
40 changes: 36 additions & 4 deletions assets/js/posts-slider.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/posts-slider.min.js

Large diffs are not rendered by default.

32 changes: 30 additions & 2 deletions assets/src/js/posts-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@ class OW_PostsSlider extends OW_Base {
onInit() {
super.onInit();

if (this.hasPostsSlider()) {
// Detect if in Elementor editor mode
if (typeof elementorFrontend !== 'undefined' && elementorFrontend.isEditMode()) {
console.log("Elementor editor detected, using delay");
setTimeout(() => {
this.detectAndInitSliders();
}, 2500); // Delay to ensure DOM is fully loaded in the editor
} else {
this.detectAndInitSliders();
}
}

detectAndInitSliders() {
this.elements = this.getDefaultElements(); // Refresh elements
const hasSlider = this.hasPostsSlider();

if (hasSlider) {
this.initSwiper();
}
}
Expand Down Expand Up @@ -162,4 +177,17 @@ class OW_PostsSlider extends OW_Base {
}

("use script");
new OW_PostsSlider();
function initializeOWPostsSlider() {
new OW_PostsSlider();
}

document.addEventListener('DOMContentLoaded', function () {
initializeOWPostsSlider();

if (typeof elementor !== 'undefined') {
elementor.hooks.addAction('frontend/element_ready/global', function () {
initializeOWPostsSlider();
});
}
});

Loading

0 comments on commit 60ca939

Please sign in to comment.