prk2
prk2

Reputation: 147

How to move HTML element with ember.js

I would like to move an element with ember.js. What is the best practice?

"move" does not mean that I move an element on coordinates,XY. It means that I change parent element for the element I want to move. Additonaly,I want to add css3 animation to the element moving.

I would like to do as follows.

before

<div id="foo">
  <div id="moved"></div>
</div>
<div id="bar"></div>
</div>

after

<div id="foo">
</div>
<div id="bar">
  <div id="moved"></div>
</div>

Upvotes: 1

Views: 424

Answers (1)

Alexander Taylor
Alexander Taylor

Reputation: 17652

animation aside, and the fact that the entire approach may be wrong also aside, if your code is literally as simple as that, you can probably use jQuery to safely detach the element from it's old location and append it to its destination element. if you use Chrome Developer Tools and do Inspect Element, and see ember-related markup that you don't know what it's doing in between your moving element's source and destination, you might mess something up by using jQuery.

var d = $("#moved").detach();
d.appendTo("#bar");

or just

$("#moved").appendTo("#bar");

Upvotes: 1

Related Questions