Away from JS disaster css disaster js private functions and css selector as container _ jquery

Source: Internet
Author: User
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:





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.