davidkpiano / flipping

Flipping awesome animations.
MIT License
1.4k stars 51 forks source link

FLIP with `appendChild` method #16

Closed monochromer closed 5 years ago

monochromer commented 5 years ago

Why is flip animation not working in this example with simple dom-manipulation via appendChild https://codepen.io/monochromer/pen/rRMLda?editors=0011

<img src="image.jpg" data-flip-key="image" />
var f = window.f = new Flipping();

var image = document.querySelector('.image');
var grid = document.querySelector('.grid');

grid.onclick = (e) => {
  var gridCell = e.target.closest('.grid__cell');
  if (!gridCell) return;

  f.read();  
  gridCell.appendChild(image);    
  f.flip();  
}
monochromer commented 5 years ago

With this lib https://unpkg.com/flipping@latest/dist/flipping.web.js it's worked, but with https://unpkg.com/flipping@latest/dist/flipping.js - no