Clone style in jQuery?

后端 未结 9 1593
轻奢々
轻奢々 2021-02-05 03:56

I have a called spn1, which has some style from inline + CSS file.

I have another called spn2

9条回答
  •  野的像风
    2021-02-05 04:29

    Take a look at this thread: https://stackoverflow.com/a/6416527/541827
    The idea is to copy all the style's properties from one item to another

    Or just use the jquery.copycss.js plugin, the answer is based on.
    Usage:

    $('#some-element').copyCSS('#another-element');  // copy all styles
    $('#some-element').copyCSS('#another-element', ['top', 'left']);  // copy just top and left
    $('#some-element').copyCSS('#another-element', null, ['top', 'left']);  // copy everything except top and left
    

提交回复
热议问题