Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Is there a better way of duplicating elements? Reply To: Is there a better way of duplicating elements?

#190803
Senff
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.