We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实现一个Tab控件,功能要求如下:
options
main
activeIndex
li
data-tab-item
关联面板元素
5
这里有个类似的功能示例
其他额外要求:
index.html
index.css
Tab.js
tab
myTab.setActiveIndex(2)
<DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <link rel="stylesheet" href="index.css" /> </head> <body> <ol id="myTab"> <li data-tab-item="panel1">one</li> <li data-tab-item="panel2">two</li> <li data-tab-item="panel3">three</li> </ol> <div id="panel1">Panel 1</div> <div id="panel2">Panel 2</div> <div id="panel3">Panel 3</div> <script src="Tab.js"></script> <script> var myTab = new Tab({ main: document.getElementById('myTab'), activeIndex: 1 }); </script> </body> </html>
function Tab(options) { // 实现构造函数 } Tab.prototype.setActiveIndex = function (activeIndex) { // 实现setActiveIndex方法 };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现一个Tab控件,功能要求如下:
options
参数,其中,main
代表tab控件主元素,activeIndex
代表tab的当前活动页面li
代表对应的一个tab项,data-tab-item
属性可以指定其关联面板元素
的id关联面板元素
变为显示,其他li的关联面板元素
变为隐藏5
这里有个类似的功能示例
其他额外要求:
index.html
、index.css
、Tab.js
tab
的目录myTab.setActiveIndex(2)
,panel3应显示,panel1和panel2应隐藏参考index.html
参考Tab.js
The text was updated successfully, but these errors were encountered: