如果要自定义插件,别人引入你的代码时,必须要满足某些规定:
封装一个选项卡的插件:
- DOCTYPE html>
-
-
-
-
-
Document -
- * {
- margin: 0;
- padding: 0;
- }
-
- ul {
- list-style: none;
- }
-
- .header {
- display: flex;
- width: 500px;
- }
-
- .header li {
- flex: 1;
- height: 50px;
- line-height: 50px;
- text-align: center;
- border: 1px solid black;
- }
-
- .box {
- position: relative;
- }
-
- .box li {
- position: absolute;
- left: 0;
- top: 0;
- width: 500px;
- height: 200px;
- background-color: yellow;
- display: none;
- }
-
- .header .active {
- background-co