Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster committed Sep 6, 2023
2 parents 5188eb8 + 9ed81ea commit 213d257
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt-graphicLottie",
"version": "2.0.2",
"version": "2.0.3",
"framework": ">=5.14",
"homepage": "https://github.com/cgkineo/adapt-graphicLottie",
"issues": "https://github.com/cgkineo/adapt-graphicLottie/issues",
Expand Down
10 changes: 9 additions & 1 deletion js/adapt-graphicLottie.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ class GraphicLottie extends Backbone.Controller {
const $img = $(img);
const div = document.createElement('div');
const $div = $(div);
$img.replaceWith($div);

// Do replaceWith using detach instead of remove to preserve
// imageready event listeners
const $parent = $img.parent();
const previousSibling = $img[0].previousSibling;
$img.detach();
if (!previousSibling) $parent.prepend($div);
else $div.insertAfter(previousSibling);

const lottieView = div.lottieView = new LottieView({
el: div,
replacedEl: img
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt-graphicLottie",
"version": "2.0.2",
"version": "2.0.3",
"framework": ">=5.14",
"homepage": "https://github.com/cgkineo/adapt-graphicLottie",
"issues": "https://github.com/cgkineo/adapt-graphicLottie/issues",
Expand Down

0 comments on commit 213d257

Please sign in to comment.