Home › Forums › JavaScript › Is there a better way of duplicating elements? › Reply To: Is there a better way of duplicating elements?
December 15, 2014 at 3:22 am
#190803
Participant
What I’ve done with my plugin that also clones items, is check the width, padding and position on the page and apply that to the cloned element (because the cloned element is the same in every way except the position, which is set to fixed
).
I’m not sure how you do that in your Pen (and I’m not sure if it’s so great to clone the entire body
), but instead of using getComputedStyle
and getPropertyValue
, I use jQuery such as $(this).css('width')
which seems to do the trick.