选项卡式内容:左边框与上方的选项卡断开连接 - html CSS jQuery
Tabbed Content: Left Border Disconnected from Tabs Above - html CSS jQuery
我正在尝试构建可重复使用的选项卡式内容。以下内容改编自 Shay Howe 的 jQuery 教程;赶上 HTML5/CSS3 技能。
我添加了边距以进一步突出显示该问题。一切都在现场,但左垂直边框与上面 tab/s 的左侧不对齐。在 CodePen 中有效,但在 Mozilla/IE.
中实践失败
有人知道如何解决这个问题吗?
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>TAB TEST</title>
<meta charset="utf-8">
<link rel="stylesheet" href="assets/main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,300,400">
</head>
<body>
<div class="tabs">
<ul class="tabs-nav">
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
</ul>
<div class="tabs-stage">
<div id="tab-1">
<p>Text for tab 1.</p>
</div>
<div id="tab-2">
<p>Text for tab 2.</p>
</div>
<div id="tab-3">
<p>Text for tab 3.</p>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="assets/script.js"></script>
</body>
</html>
CSS:
body {
MARGIN: 1.5%
color: #666;
font: 14px/24px "Open Sans", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Sans-Serif;
}
.tabs {
max-width: 66.66666%;
MARGIN-LEFT: 50px
}
.tabs-nav li {
float: left;
width: 33.33333%;
list-style-type: none;
}
.tabs-nav li:first-child a {
border-right: 0;
border-top-left-radius: 6px;
}
.tabs-nav li:last-child a {
border-top-right-radius: 6px;
}
a {
background: #eaeaed;
border: 1px solid #cecfd5;
color: #0087cc;
display: block;
font-weight: 600;
padding: 10px 0;
text-align: center;
text-decoration: none;
}
a:hover {
color: #ff7b29;
}
.tab-active a {
background: #fff;
border-bottom-color: transparent;
color: #2db34a;
cursor: default;
}
.tabs-stage {
border: 1px solid #cecfd5;
border-radius: 0px 0 6px 6px;
border-top: 0;
clear: both;
padding: 30px 30px;
position: relative;
top: 0px;
}
jQuery(jscript):
// Show the first tab by default
$('.tabs-stage div').hide();
$('.tabs-stage div:first').show();
$('.tabs-nav li:first').addClass('tab-active');
// Change tab class and display content
$('.tabs-nav a').on('click', function(event) {
event.preventDefault();
$('.tabs-nav li').removeClass('tab-active');
$(this).parent().addClass('tab-active');
$('.tabs-stage div').hide();
$($(this).attr('href')).show();
});
$('.tabs-stage div').hide();
$('.tabs-stage div:first').show();
$('.tabs-nav li:first').addClass('tab-active');
// Change tab class and display content
$('.tabs-nav a').on('click', function(event) {
event.preventDefault();
$('.tabs-nav li').removeClass('tab-active');
$(this).parent().addClass('tab-active');
$('.tabs-stage div').hide();
$($(this).attr('href')).show();
});
body {
MARGIN: 1.5%
color: #666;
font: 14px/24px "Open Sans", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Sans-Serif;
}
.tabs {
max-width: 66.66666%;
MARGIN-LEFT: 50px
}
.tabs-nav li {
float: left;
width: 33.33333%;
list-style-type: none;
}
.tabs-nav li:first-child a {
border-right: 0;
border-top-left-radius: 6px;
}
.tabs-nav li:last-child a {
border-top-right-radius: 6px;
}
.tabs-nav {
padding-left: 0;}
a {
background: #eaeaed;
border: 1px solid #cecfd5;
color: #0087cc;
display: block;
font-weight: 600;
padding: 10px 0;
text-align: center;
text-decoration: none;
}
a:hover {
color: #ff7b29;
}
.tab-active a {
background: #fff;
border-bottom-color: transparent;
color: #2db34a;
cursor: default;
}
.tabs-stage {
border: 1px solid #cecfd5;
border-radius: 0px 0 6px 6px;
border-top: 0;
clear: both;
padding: 30px 30px;
position: relative;
top: 0px;
}
<body>
<div class="tabs">
<ul class="tabs-nav">
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
</ul>
<div class="tabs-stage">
<div id="tab-1">
<p>Text for tab 1.</p>
</div>
<div id="tab-2">
<p>Text for tab 2.</p>
</div>
<div id="tab-3">
<p>Text for tab 3.</p>
</div>
</div>
</div>
尝试添加 padding-left: 0;到你的 ul class="tabs-nav"
基于 css 制作的选项卡式内容的另一个示例:已检查的伪 class 和一小段纯 JavaScript 代码。未使用 jQuery 或使用其他库。
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Tabbed Content</title>
<style type="text/css">
.wrapper4 {
padding: 0;
float: left;
margin: 2%;
/*
Automatic calculation for the width of adjacent div.wrapper4 explained:
Take the whole width of the parent element and divide it by a number of
.wrapper4, then substract the .wrapper4 margin (above) multiplied by 2
(left and right margin) and substract 1% of the parent width just to be
sure to fit in.
Adjust this value manually for each .wrapper4 if you need to place them
in various regions of the page.
*/
width: calc(100% / 2 - 2% * 2 - 1%);
}
.wrapper4 > .tabs .tab, .wrapper4 > .tabbed > [type=radio] + .content, .wrapper4 > .tabs {
border: 3px solid lime;
}
.wrapper4 > .tabs {
border-top: none;
border-left: none;
border-right: none;
}
.wrapper4 > .tabs .tab {
display: inline-block;
background-color: lightGrey;
padding: 5px;
margin-bottom: -3px;/* Negating .tabs border-width */
}
.wrapper4 > .tabs .clicked{
border-bottom-color: transparent;
padding-top: 10px; /* Makes .clicked tab a bit higher (5px * 2). */
}
.wrapper4 > .tabbed > [type=radio] + .content {
padding: 10px;
border-top: none;
overflow: hidden;
}
.wrapper4 > .tabbed > [type=radio], .wrapper4 > .tabbed > :not(:checked) + .content {
display: none;
}
.wrapper4 > .tabbed > :checked + .content {
display: block;
}
.wrapper4 > .tabs :not(.clicked):hover {
background-color: darkGrey;
cursor: pointer;
}
.wrapper4 > .tabs .clicked, .wrapper4 > .tabbed > [type=radio] + .content {
background-color: pink;
}
</style>
</head>
<body>
<noscript>
<h3 style="text-align: center;"><mark>You need to enable JavaScript to see tabbed content on this page.</mark></h3>
</noscript>
<!-- First block of tabbed content. -->
<div class="wrapper4">
<nav class="tabs">
<label class="tab">Tab One</label>
<label class="tab">Tab Two</label>
<label class="tab">Tab Three</label>
</nav>
<div class="tabbed">
<!-- By default this tab is chosen using `checked' property. -->
<input type="radio" checked>
<!-- Put inside section.content any HTML content for the tab. -->
<section class="content">
<h2>Stuff for Tab One</h2>
<p>To add more tabs just put more <label class="tab"> elements with their relative <div class="tabbed"> blocks. The <mark>id</mark>, <mark>for</mark> and <mark>name</mark> attributes are added dynamically to the elements by JavaScript. For supporting fallback when JavaScript is disabled you have manually add those attributes for each radio and label element. Example:
<br>
<strong>
<label class="tab" for="tab-1">
</strong>
<br>
<strong>
<input type="radio" id="tab-1" name="the-same-for-each-block-of-tabbed-content">
</strong>
<br>
Also, you can do the same if for some reason you need your own attributes on some or all elements.
</p>
<p><em>Any number of tabs could be added on any number of blocks of tabbed content.</em></p>
</section>
</div>
<div class="tabbed">
<input type="radio">
<section class="content">
<h2>Stuff for Tab Two</h2>
<img style="float:left;" alt="Lorem Ipsum" title="Lorem Ipsum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAEsCAYAAAA1nhbhAAALpElEQVR4nO2dy5XrIAyGacEtpIVpIS14l3VacAsuwS24oKknd3HDHEIkECAMxv93Drs8bAR6IcAYAAAAAAAAzLqur3VdX62fA5j/wjDG/LXn8wnBtMQXiIFg2rIsCykQY8zrdrtBKEfznglsm6YJQjmSeZ6DAnk3cBTvGcA2eF/HA2H0QsigQxgNiKmrho92PbZt+zW8VwUP62jeMcZX27bt11VliEUOgJsdbue77jCEUhludoQ+9/PzA6HUgJsd7xnxhWtTIJQKSGeHZd/3h/s5CEURLrMbizn870EoemRndP2cF4RSyLsDi4I/X91BKJlwquodbyThR/cQSh5fwsjtSN/IG8QpaWioKh9qxkEoArhsrkYml1rYQu4rAKVajNEtXuBimvd/AxcqtV7DAHMpfKynOFB2o5Y64WaiCaRjLkWgaKEaoZXHS7vFXLxxhE6/3++sUI56hq7gsrhH6vJA4vKSKkwlEq/xHG6bpukSs6Wb0cj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VdKkZ69rdlqNYPMwQu6k5IDj1CLtQtUmwn2eU7q7fn1tboft+/5IOUKj5llVt9sNZ7275Ox6sjOy0SNfh1xvzs4gCKkSKevkoWbtkG2lRXs2PUM1ajCdbq+JhNLdWi3bafcqSti27TcjO9CkHbEdvCtiW+ZaNNxhZdLd5xpt6OxwCVqOgKQ9n89xy4VqUEM48zxDJWlQsq8eQjiAUNxgDTPUEQAAAAAAAOBq/AOWrdk1HQ4NlAAAAABJRU5ErkJggg==">
<p>Sed egestas lorem mi, quis fringilla arcu fermentum pellentesque. Praesent auctor sed diam at pharetra. Vivamus a sem libero. Donec augue lorem, cursus ac sem sit amet, commodo commodo est. Ut sodales elementum ipsum, nec tempor nulla tincidunt et. Vivamus sodales pharetra nunc ut commodo. Proin sed vehicula tortor, finibus mollis ipsum. Vestibulum rutrum lobortis ligula, eu pretium sapien malesuada rhoncus. Phasellus auctor quam quis eleifend laoreet.</p>
<h3>Donec eleifend sem eu metus facilisis</h3>
<p>Nam cursus risus dignissim nunc bibendum dictum. Aliquam fermentum, odio auctor congue vulputate, dui diam mattis massa, cursus dapibus elit nulla et sem. Mauris convallis arcu at rutrum aliquam. Aenean lectus enim, faucibus a tellus sit amet, vulputate mattis augue. Donec eleifend sem eu metus facilisis, mattis porta lacus viverra. Donec tincidunt lacus vel leo mattis, sit amet auctor ligula tempus. Integer dapibus lacus a dui pellentesque, ac porttitor mi venenatis. Proin a justo at enim consequat molestie. Sed eget feugiat nulla.</p>
</section>
</div>
<div class="tabbed">
<input type="radio">
<section class="content">
<h2>Stuff for Tab Three</h2>
<p>To be continued ...</p>
</section>
</div>
</div>
<!-- Second block of tabbed content. -->
<div class="wrapper4">
<nav class="tabs">
<label class="tab">Tab One</label>
<label class="tab">Tab Two</label>
</nav>
<div class="tabbed">
<input type="radio" >
<section class="content">
<h2>Stuff for Tab One</h2>
<img style="float:right;" alt="Enjoy" title="Enjoy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCAY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Q9kgewG4NWwjCPkp82aurGOYTiEN4QGpkknWQvlRphvANACXZPrthzZzMYzlSUP4SY2SSd4DMANAL4RvmQYhvLZDaRXex+BpF4wDuQnhOUV6X5pFmynP7MAZxix8CE8pOQd9xvgewDPQv6CKYWyJF+EPLrwI4CKUjXEewGrw52KYLowb4Y82XANgymVNRnhMwjAMwzAMwzAMwzAMwzAMwzAMo4X/Bx879DSTfDNyAAAAAElFTkSuQmCC">
<p><em>Enjoy )) ...</em></p>
</section>
</div>
<div class="tabbed">
<input type="radio" checked>
<section class="content">
<h2>Stuff for Tab Two</h2>
<p>This is the second block of tabbed content. Note that in this block the <strong>Tab Two</strong> is chosen by default. You can change this behaviour by moving <mark>checked</mark> default attribute on another radio input element.</p>
</section>
</div>
</div>
<!-- The script automatically sets `id' and `name' attribute for each radio
input element and `for' attribute for each its respective label in the stack.
Also, sets onclick event handling for labels, which adds or removes `clicked'
class on them.
The manually added `id' and `for' attributes are NOT overwritten. -->
<script type="text/javascript">
(function() {
var i = 0,
labels = document.querySelectorAll('.wrapper4 > .tabs .tab'),
wrapper4 = labels ? labels[i].parentElement.parentElement : false,
radios = document.querySelectorAll('.wrapper4 > .tabbed > [type="radio"]');
if (!wrapper4 || !radios || wrapper4 !== radios[i].parentElement.parentElement) {
alert('ERROR: Wrapper for tabbed content is invalid.');
return;
}
[].forEach.call(labels, function(label) {
label.htmlFor = label.htmlFor.length ? label.htmlFor : Math.random().toString();
label.onclick = function (e){
[].forEach.call(labels, function(label) {
if (e.target === label){
e.target.classList.add('clicked');
}else if (e.target.parentElement === label.parentElement) {
label.classList.remove('clicked');
}
});
};
});
[].forEach.call(radios,function(radio, index) {
if (wrapper4 !== radio.parentElement.parentElement) {
wrapper4 = radio.parentElement.parentElement;
i++;
}
radio.name = 'hidden-radios-group-' + i;
if (radio.id.length) {
labels[index].htmlFor = radio.id;
} else {
radio.id = labels[index].htmlFor;
}
radio.checked && labels[index].classList.add('clicked');
});
})()
</script>
</body>
</html>
我正在尝试构建可重复使用的选项卡式内容。以下内容改编自 Shay Howe 的 jQuery 教程;赶上 HTML5/CSS3 技能。
我添加了边距以进一步突出显示该问题。一切都在现场,但左垂直边框与上面 tab/s 的左侧不对齐。在 CodePen 中有效,但在 Mozilla/IE.
中实践失败有人知道如何解决这个问题吗?
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>TAB TEST</title>
<meta charset="utf-8">
<link rel="stylesheet" href="assets/main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,300,400">
</head>
<body>
<div class="tabs">
<ul class="tabs-nav">
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
</ul>
<div class="tabs-stage">
<div id="tab-1">
<p>Text for tab 1.</p>
</div>
<div id="tab-2">
<p>Text for tab 2.</p>
</div>
<div id="tab-3">
<p>Text for tab 3.</p>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="assets/script.js"></script>
</body>
</html>
CSS:
body {
MARGIN: 1.5%
color: #666;
font: 14px/24px "Open Sans", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Sans-Serif;
}
.tabs {
max-width: 66.66666%;
MARGIN-LEFT: 50px
}
.tabs-nav li {
float: left;
width: 33.33333%;
list-style-type: none;
}
.tabs-nav li:first-child a {
border-right: 0;
border-top-left-radius: 6px;
}
.tabs-nav li:last-child a {
border-top-right-radius: 6px;
}
a {
background: #eaeaed;
border: 1px solid #cecfd5;
color: #0087cc;
display: block;
font-weight: 600;
padding: 10px 0;
text-align: center;
text-decoration: none;
}
a:hover {
color: #ff7b29;
}
.tab-active a {
background: #fff;
border-bottom-color: transparent;
color: #2db34a;
cursor: default;
}
.tabs-stage {
border: 1px solid #cecfd5;
border-radius: 0px 0 6px 6px;
border-top: 0;
clear: both;
padding: 30px 30px;
position: relative;
top: 0px;
}
jQuery(jscript):
// Show the first tab by default
$('.tabs-stage div').hide();
$('.tabs-stage div:first').show();
$('.tabs-nav li:first').addClass('tab-active');
// Change tab class and display content
$('.tabs-nav a').on('click', function(event) {
event.preventDefault();
$('.tabs-nav li').removeClass('tab-active');
$(this).parent().addClass('tab-active');
$('.tabs-stage div').hide();
$($(this).attr('href')).show();
});
$('.tabs-stage div').hide();
$('.tabs-stage div:first').show();
$('.tabs-nav li:first').addClass('tab-active');
// Change tab class and display content
$('.tabs-nav a').on('click', function(event) {
event.preventDefault();
$('.tabs-nav li').removeClass('tab-active');
$(this).parent().addClass('tab-active');
$('.tabs-stage div').hide();
$($(this).attr('href')).show();
});
body {
MARGIN: 1.5%
color: #666;
font: 14px/24px "Open Sans", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Sans-Serif;
}
.tabs {
max-width: 66.66666%;
MARGIN-LEFT: 50px
}
.tabs-nav li {
float: left;
width: 33.33333%;
list-style-type: none;
}
.tabs-nav li:first-child a {
border-right: 0;
border-top-left-radius: 6px;
}
.tabs-nav li:last-child a {
border-top-right-radius: 6px;
}
.tabs-nav {
padding-left: 0;}
a {
background: #eaeaed;
border: 1px solid #cecfd5;
color: #0087cc;
display: block;
font-weight: 600;
padding: 10px 0;
text-align: center;
text-decoration: none;
}
a:hover {
color: #ff7b29;
}
.tab-active a {
background: #fff;
border-bottom-color: transparent;
color: #2db34a;
cursor: default;
}
.tabs-stage {
border: 1px solid #cecfd5;
border-radius: 0px 0 6px 6px;
border-top: 0;
clear: both;
padding: 30px 30px;
position: relative;
top: 0px;
}
<body>
<div class="tabs">
<ul class="tabs-nav">
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
</ul>
<div class="tabs-stage">
<div id="tab-1">
<p>Text for tab 1.</p>
</div>
<div id="tab-2">
<p>Text for tab 2.</p>
</div>
<div id="tab-3">
<p>Text for tab 3.</p>
</div>
</div>
</div>
尝试添加 padding-left: 0;到你的 ul class="tabs-nav"
基于 css 制作的选项卡式内容的另一个示例:已检查的伪 class 和一小段纯 JavaScript 代码。未使用 jQuery 或使用其他库。
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Tabbed Content</title>
<style type="text/css">
.wrapper4 {
padding: 0;
float: left;
margin: 2%;
/*
Automatic calculation for the width of adjacent div.wrapper4 explained:
Take the whole width of the parent element and divide it by a number of
.wrapper4, then substract the .wrapper4 margin (above) multiplied by 2
(left and right margin) and substract 1% of the parent width just to be
sure to fit in.
Adjust this value manually for each .wrapper4 if you need to place them
in various regions of the page.
*/
width: calc(100% / 2 - 2% * 2 - 1%);
}
.wrapper4 > .tabs .tab, .wrapper4 > .tabbed > [type=radio] + .content, .wrapper4 > .tabs {
border: 3px solid lime;
}
.wrapper4 > .tabs {
border-top: none;
border-left: none;
border-right: none;
}
.wrapper4 > .tabs .tab {
display: inline-block;
background-color: lightGrey;
padding: 5px;
margin-bottom: -3px;/* Negating .tabs border-width */
}
.wrapper4 > .tabs .clicked{
border-bottom-color: transparent;
padding-top: 10px; /* Makes .clicked tab a bit higher (5px * 2). */
}
.wrapper4 > .tabbed > [type=radio] + .content {
padding: 10px;
border-top: none;
overflow: hidden;
}
.wrapper4 > .tabbed > [type=radio], .wrapper4 > .tabbed > :not(:checked) + .content {
display: none;
}
.wrapper4 > .tabbed > :checked + .content {
display: block;
}
.wrapper4 > .tabs :not(.clicked):hover {
background-color: darkGrey;
cursor: pointer;
}
.wrapper4 > .tabs .clicked, .wrapper4 > .tabbed > [type=radio] + .content {
background-color: pink;
}
</style>
</head>
<body>
<noscript>
<h3 style="text-align: center;"><mark>You need to enable JavaScript to see tabbed content on this page.</mark></h3>
</noscript>
<!-- First block of tabbed content. -->
<div class="wrapper4">
<nav class="tabs">
<label class="tab">Tab One</label>
<label class="tab">Tab Two</label>
<label class="tab">Tab Three</label>
</nav>
<div class="tabbed">
<!-- By default this tab is chosen using `checked' property. -->
<input type="radio" checked>
<!-- Put inside section.content any HTML content for the tab. -->
<section class="content">
<h2>Stuff for Tab One</h2>
<p>To add more tabs just put more <label class="tab"> elements with their relative <div class="tabbed"> blocks. The <mark>id</mark>, <mark>for</mark> and <mark>name</mark> attributes are added dynamically to the elements by JavaScript. For supporting fallback when JavaScript is disabled you have manually add those attributes for each radio and label element. Example:
<br>
<strong>
<label class="tab" for="tab-1">
</strong>
<br>
<strong>
<input type="radio" id="tab-1" name="the-same-for-each-block-of-tabbed-content">
</strong>
<br>
Also, you can do the same if for some reason you need your own attributes on some or all elements.
</p>
<p><em>Any number of tabs could be added on any number of blocks of tabbed content.</em></p>
</section>
</div>
<div class="tabbed">
<input type="radio">
<section class="content">
<h2>Stuff for Tab Two</h2>
<img style="float:left;" alt="Lorem Ipsum" title="Lorem Ipsum" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAEsCAYAAAA1nhbhAAALpElEQVR4nO2dy5XrIAyGacEtpIVpIS14l3VacAsuwS24oKknd3HDHEIkECAMxv93Drs8bAR6IcAYAAAAAAAAzLqur3VdX62fA5j/wjDG/LXn8wnBtMQXiIFg2rIsCykQY8zrdrtBKEfznglsm6YJQjmSeZ6DAnk3cBTvGcA2eF/HA2H0QsigQxgNiKmrho92PbZt+zW8VwUP62jeMcZX27bt11VliEUOgJsdbue77jCEUhludoQ+9/PzA6HUgJsd7xnxhWtTIJQKSGeHZd/3h/s5CEURLrMbizn870EoemRndP2cF4RSyLsDi4I/X91BKJlwquodbyThR/cQSh5fwsjtSN/IG8QpaWioKh9qxkEoArhsrkYml1rYQu4rAKVajNEtXuBimvd/AxcqtV7DAHMpfKynOFB2o5Y64WaiCaRjLkWgaKEaoZXHS7vFXLxxhE6/3++sUI56hq7gsrhH6vJA4vKSKkwlEq/xHG6bpukSs6Wb0cjNVL+9VdyQVHvZdV1fnJMwz/Pr3flfhIw89Tsaz9oFVAxQIoxt235jtb5+47yoQMpmWMGoCGNd11fMQ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SNfh1xvzs4gCKkSKevkoWbtkG2lRXs2PUM1ajCdbq+JhNLdWi3bafcqSti27TcjO9CkHbEdvCtiW+ZaNNxhZdLd5xpt6OxwCVqOgKQ9n89xy4VqUEM48zxDJWlQsq8eQjiAUNxgDTPUEQAAAAAAAOBq/AOWrdk1HQ4NlAAAAABJRU5ErkJggg==">
<p>Sed egestas lorem mi, quis fringilla arcu fermentum pellentesque. Praesent auctor sed diam at pharetra. Vivamus a sem libero. Donec augue lorem, cursus ac sem sit amet, commodo commodo est. Ut sodales elementum ipsum, nec tempor nulla tincidunt et. Vivamus sodales pharetra nunc ut commodo. Proin sed vehicula tortor, finibus mollis ipsum. Vestibulum rutrum lobortis ligula, eu pretium sapien malesuada rhoncus. Phasellus auctor quam quis eleifend laoreet.</p>
<h3>Donec eleifend sem eu metus facilisis</h3>
<p>Nam cursus risus dignissim nunc bibendum dictum. Aliquam fermentum, odio auctor congue vulputate, dui diam mattis massa, cursus dapibus elit nulla et sem. Mauris convallis arcu at rutrum aliquam. Aenean lectus enim, faucibus a tellus sit amet, vulputate mattis augue. Donec eleifend sem eu metus facilisis, mattis porta lacus viverra. Donec tincidunt lacus vel leo mattis, sit amet auctor ligula tempus. Integer dapibus lacus a dui pellentesque, ac porttitor mi venenatis. Proin a justo at enim consequat molestie. Sed eget feugiat nulla.</p>
</section>
</div>
<div class="tabbed">
<input type="radio">
<section class="content">
<h2>Stuff for Tab Three</h2>
<p>To be continued ...</p>
</section>
</div>
</div>
<!-- Second block of tabbed content. -->
<div class="wrapper4">
<nav class="tabs">
<label class="tab">Tab One</label>
<label class="tab">Tab Two</label>
</nav>
<div class="tabbed">
<input type="radio" >
<section class="content">
<h2>Stuff for Tab One</h2>
<img style="float:right;" alt="Enjoy" title="Enjoy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCAYAAACb3McZAAAThklEQVR4nO2deXQVZZrGn7tkudkDN+sNubkEA2FJ2JIQSFDpZmlsGEGxGwEXGB2lEfq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YhvLZDaRXex+BpF4wDuQnhOUV6X5pFmynP7MAZxix8CE8pOQd9xvgewDPQv6CKYWyJF+EPLrwI4CKUjXEewGrw52KYLowb4Y82XANgymVNRnhMwjAMwzAMwzAMwzAMwzAMwzAMo4X/Bx879DSTfDNyAAAAAElFTkSuQmCC">
<p><em>Enjoy )) ...</em></p>
</section>
</div>
<div class="tabbed">
<input type="radio" checked>
<section class="content">
<h2>Stuff for Tab Two</h2>
<p>This is the second block of tabbed content. Note that in this block the <strong>Tab Two</strong> is chosen by default. You can change this behaviour by moving <mark>checked</mark> default attribute on another radio input element.</p>
</section>
</div>
</div>
<!-- The script automatically sets `id' and `name' attribute for each radio
input element and `for' attribute for each its respective label in the stack.
Also, sets onclick event handling for labels, which adds or removes `clicked'
class on them.
The manually added `id' and `for' attributes are NOT overwritten. -->
<script type="text/javascript">
(function() {
var i = 0,
labels = document.querySelectorAll('.wrapper4 > .tabs .tab'),
wrapper4 = labels ? labels[i].parentElement.parentElement : false,
radios = document.querySelectorAll('.wrapper4 > .tabbed > [type="radio"]');
if (!wrapper4 || !radios || wrapper4 !== radios[i].parentElement.parentElement) {
alert('ERROR: Wrapper for tabbed content is invalid.');
return;
}
[].forEach.call(labels, function(label) {
label.htmlFor = label.htmlFor.length ? label.htmlFor : Math.random().toString();
label.onclick = function (e){
[].forEach.call(labels, function(label) {
if (e.target === label){
e.target.classList.add('clicked');
}else if (e.target.parentElement === label.parentElement) {
label.classList.remove('clicked');
}
});
};
});
[].forEach.call(radios,function(radio, index) {
if (wrapper4 !== radio.parentElement.parentElement) {
wrapper4 = radio.parentElement.parentElement;
i++;
}
radio.name = 'hidden-radios-group-' + i;
if (radio.id.length) {
labels[index].htmlFor = radio.id;
} else {
radio.id = labels[index].htmlFor;
}
radio.checked && labels[index].classList.add('clicked');
});
})()
</script>
</body>
</html>