When a project is huge to a certain stage, for example, after the UI presentation layer is modularized, a js disaster and css disaster will occur, two js or css files that have never been put together before are often put on one page inexplicably. The basic reason is module reuse, although js can construct objects like object-oriented objects, hiding private methods is usually faster than when you write programs, and the time for designing js objects is gone, so I prefer to use js private functions and js methods; jquery private functions and jquery external exposure methods can also be implemented, while the html structure generated by pages is completely generated in js, including which IDs and classes, in this way, the convenience of unification and reuse can be ensured to the maximum extent, but there is also a drawback, that is, if the style needs to be changed during reuse (the structure cannot be changed because the structure is dead ), you need to package the original structure with p, and the relevant style needs to be wrapped with the corresponding id. If it is a new event, you can only bind it to it, no good method yet
For example, we need to include several images in a p.
This also has the disadvantage that css must be copied once before modification, but the structure and style and js can be reused.
The Code is as follows: