davidkpiano / flipping

Flipping awesome animations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FLIP with `appendChild` method

monochromer opened this issue · comments

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();  
}