87 lines
2.2 KiB
HTML
Executable File
87 lines
2.2 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="zh-cmn-hans">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<link href="../static/kico.css" rel="stylesheet" type="text/css"/>
|
|
<style>
|
|
.ks-tab{
|
|
|
|
}
|
|
.ks-tab-toggle{
|
|
display: flex;
|
|
flex: 1 1 100%;
|
|
text-align: center;
|
|
flex-direction: row;
|
|
}
|
|
.ks-tab-toggle span{
|
|
width: 100%;
|
|
padding: 1em;
|
|
display: block;
|
|
cursor: pointer;
|
|
background: #e0e0e0;
|
|
}
|
|
.ks-tab-content{
|
|
display: none;
|
|
padding: 1em;
|
|
background: #efefef;
|
|
}
|
|
.ks-tab-content.active{
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<tab class="ks-tab">
|
|
<section class="ks-tab-toggle">
|
|
<span>效果</span>
|
|
<span>代码</span>
|
|
</section>
|
|
<section class="ks-tab-content">
|
|
<h1>H1 超大标题</h1>
|
|
<h2>H2 大标题</h2>
|
|
<h3>H3 小标题</h3>
|
|
<h4>H4 标题</h4>
|
|
<h5>H5 标题</h5>
|
|
<h6>H6 标题</h6>
|
|
</section>
|
|
<section class="ks-tab-content">
|
|
<pre><code><h1>H1 超大标题</h1>
|
|
<h2>H2 大标题</h2>
|
|
<h3>H3 小标题</h3>
|
|
<h4>H4 标题</h4>
|
|
<h5>H5 标题</h5>
|
|
<h6>H6 标题</h6></code></pre>
|
|
</section>
|
|
</tab>
|
|
|
|
<script>
|
|
function tab(actions, contents){
|
|
var act = [];
|
|
var cont = [];
|
|
|
|
contents[0].classList.add("active");
|
|
|
|
function aaa(obj, obj2) {
|
|
obj.onclick = function () {
|
|
var aaa = cont;
|
|
aaa.splice(cont.indexOf(obj2), 1);
|
|
|
|
for(var n in aaa){
|
|
aaa[n].classList.remove("active");
|
|
}
|
|
|
|
obj2.classList.add("active");
|
|
};
|
|
}
|
|
for(var i = 0; i < actions.length; i++){
|
|
act.push(actions[i]);
|
|
cont.push(contents[i]);
|
|
aaa(actions[i], contents[i]);
|
|
}
|
|
}
|
|
tab(document.getElementsByClassName("ks-tab-toggle")[0].getElementsByTagName("span"), document.getElementsByClassName("ks-tab-content"));
|
|
</script>
|
|
|
|
</body>
|
|
</html> |