Есть готовый код. Простой и понятный... как казалось на первый взгляд. Однако, не получается добавить новую вкладку. Делаю все по аналогии с уже имеющимися и не работает. Точнее, сама вкладка появляется, но только она пустая, хотя содержимое в ней указано.
Подскажите, что не так делаю. Может что-то упустил?! Код прилагаю...
/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
* Build: http://www.modernizr.com/download/#-shiv-cssclasses-load
*/
;
window.Modernizr = function(a, b, c) {
function u(a) {
j.cssText = a
}
function v(a, b) {
return u(prefixes.join(a + ";") + (b || ""))
}
function w(a, b) {
return typeof a === b
}
function x(a, b) {
return !!~("" + a).indexOf(b)
}
function y(a, b, d) {
for (var e in a) {
var f = b[a[e]];
if (f !== c) return d === !1 ? a[e] : w(f, "function") ? f.bind(d || b) : f
}
return !1
}
var d = "2.5.3",
e = {},
f = !0,
g = b.documentElement,
h = "modernizr",
i = b.createElement(h),
j = i.style,
k, l = {}.toString,
m = {},
n = {},
o = {},
p = [],
q = p.slice,
r, s = {}.hasOwnProperty,
t;
!w(s, "undefined") && !w(s.call, "undefined") ? t = function(a, b) {
return s.call(a, b)
} : t = function(a, b) {
return b in a && w(a.constructor.prototype[b], "undefined")
}, Function.prototype.bind || (Function.prototype.bind = function(b) {
var c = this;
if (typeof c != "function") throw new TypeError;
var d = q.call(arguments, 1),
e = function() {
if (this instanceof e) {
var a = function() {};
a.prototype = c.prototype;
var f = new a,
g = c.apply(f, d.concat(q.call(arguments)));
return Object(g) === g ? g : f
}
return c.apply(b, d.concat(q.call(arguments)))
};
return e
});
for (var z in m) t(m, z) && (r = z.toLowerCase(), e[r] = m[z](), p.push((e[r] ? "" : "no-") + r));
return u(""), i = k = null,
function(a, b) {
function g(a, b) {
var c = a.createElement("p"),
d = a.getElementsByTagName("head")[0] || a.documentElement;
return c.innerHTML = "x<style>" + b + "</style>", d.insertBefore(c.lastChild, d.firstChild)
}
function h() {
var a = k.elements;
return typeof a == "string" ? a.split(" ") : a
}
function i(a) {
var b = {},
c = a.createElement,
e = a.createDocumentFragment,
f = e();
a.createElement = function(a) {
var e = (b[a] || (b[a] = c(a))).cloneNode();
return k.shivMethods && e.canHaveChildren && !d.test(a) ? f.appendChild(e) : e
}, a.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + h().join().replace(/\w+/g, function(a) {
return b[a] = c(a), f.createElement(a), 'c("' + a + '")'
}) + ");return n}")(k, f)
}
function j(a) {
var b;
return a.documentShived ? a : (k.shivCSS && !e && (b = !!g(a, "article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")), f || (b = !i(a)), b && (a.documentShived = b), a)
}
var c = a.html5 || {},
d = /^<|^(?:button|form|map|select|textarea)$/i,
e, f;
(function() {
var a = b.createElement("a");
a.innerHTML = "<xyz></xyz>", e = "hidden" in a, f = a.childNodes.length == 1 || function() {
try {
b.createElement("a")
} catch (a) {
return !0
}
var c = b.createDocumentFragment();
return typeof c.cloneNode == "undefined" || typeof c.createDocumentFragment == "undefined" || typeof c.createElement == "undefined"
}()
})();
var k = {
elements: c.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",
shivCSS: c.shivCSS !== !1,
shivMethods: c.shivMethods !== !1,
type: "default",
shivDocument: j
};
a.html5 = k, j(b)
}(this, b), e._version = d, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (f ? " js " + p.join(" ") : ""), e
}(this, this.document),
function(a, b, c) {
function d(a) {
return o.call(a) == "[object Function]"
}
function e(a) {
return typeof a == "string"
}
function f() {}
function g(a) {
return !a || a == "loaded" || a == "complete" || a == "uninitialized"
}
function h() {
var a = p.shift();
q = 1, a ? a.t ? m(function() {
(a.t == "c" ? B.injectCss : B.injectJs)(a.s, 0, a.a, a.x, a.e, 1)
}, 0) : (a(), h()) : q = 0
}
function i(a, c, d, e, f, i, j) {
function k(b) {
if (!o && g(l.readyState) && (u.r = o = 1, !q && h(), l.onload = l.onreadystatechange = null, b)) {
a != "img" && m(function() {
t.removeChild(l)
}, 50);
for (var d in y[c]) y[c].hasOwnProperty(d) && y[c][d].onload()
}
}
var j = j || B.errorTimeout,
l = {},
o = 0,
r = 0,
u = {
t: d,
s: c,
e: f,
a: i,
x: j
};
y[c] === 1 && (r = 1, y[c] = [], l = b.createElement(a)), a == "object" ? l.data = c : (l.src = c, l.type = a), l.width = l.height = "0", l.onerror = l.onload = l.onreadystatechange = function() {
k.call(this, r)
}, p.splice(e, 0, u), a != "img" && (r || y[c] === 2 ? (t.insertBefore(l, s ? null : n), m(k, j)) : y[c].push(l))
}
function j(a, b, c, d, f) {
return q = 0, b = b || "j", e(a) ? i(b == "c" ? v : u, a, b, this.i++, c, d, f) : (p.splice(this.i++, 0, a), p.length == 1 && h()), this
}
function k() {
var a = B;
return a.loader = {
load: j,
i: 0
}, a
}
var l = b.documentElement,
m = a.setTimeout,
n = b.getElementsByTagName("script")[0],
o = {}.toString,
p = [],
q = 0,
r = "MozAppearance" in l.style,
s = r && !!b.createRange().compareNode,
t = s ? l : n.parentNode,
l = a.opera && o.call(a.opera) == "[object Opera]",
l = !!b.attachEvent && !l,
u = r ? "object" : l ? "script" : "img",
v = l ? "script" : u,
w = Array.isArray || function(a) {
return o.call(a) == "[object Array]"
},
x = [],
y = {},
z = {
timeout: function(a, b) {
return b.length && (a.timeout = b[0]), a
}
},
A, B;
B = function(a) {
function b(a) {
var a = a.split("!"),
b = x.length,
c = a.pop(),
d = a.length,
c = {
url: c,
origUrl: c,
prefixes: a
},
e, f, g;
for (f = 0; f < d; f++) g = a[f].split("="), (e = z[g.shift()]) && (c = e(c, g));
for (f = 0; f < b; f++) c = x[f](c);
return c
}
function g(a, e, f, g, i) {
var j = b(a),
l = j.autoCallback;
j.url.split(".").pop().split("?").shift(), j.bypass || (e && (e = d(e) ? e : e[a] || e[g] || e[a.split("/").pop().split("?")[0]] || h), j.instead ? j.instead(a, e, f, g, i) : (y[j.url] ? j.noexec = !0 : y[j.url] = 1, f.load(j.url, j.forceCSS || !j.forceJS && "css" == j.url.split(".").pop().split("?").shift() ? "c" : c, j.noexec, j.attrs, j.timeout), (d(e) || d(l)) && f.load(function() {
k(), e && e(j.origUrl, i, g), l && l(j.origUrl, i, g), y[j.url] = 2
})))
}
function i(a, b) {
function c(a, c) {
if (a) {
if (e(a)) c || (j = function() {
var a = [].slice.call(arguments);
k.apply(this, a), l()
}), g(a, j, b, 0, h);
else if (Object(a) === a)
for (n in m = function() {
var b = 0,
c;
for (c in a) a.hasOwnProperty(c) && b++;
return b
}(), a) a.hasOwnProperty(n) && (!c && !--m && (d(j) ? j = function() {
var a = [].slice.call(arguments);
k.apply(this, a), l()
} : j[n] = function(a) {
return function() {
var b = [].slice.call(arguments);
a && a.apply(this, b), l()
}
}(k[n])), g(a[n], j, b, n, h))
} else !c && l()
}
var h = !!a.test,
i = a.load || a.both,
j = a.callback || f,
k = j,
l = a.complete || f,
m, n;
c(h ? a.yep : a.nope, !!i), i && c(i)
}
var j, l, m = this.yepnope.loader;
if (e(a)) g(a, 0, m, 0);
else if (w(a))
for (j = 0; j < a.length; j++) l = a[j], e(l) ? g(l, 0, m, 0) : w(l) ? B(l) : Object(l) === l && i(l, m);
else Object(a) === a && i(a, m)
}, B.addPrefix = function(a, b) {
z[a] = b
}, B.addFilter = function(a) {
x.push(a)
}, B.errorTimeout = 1e4, b.readyState == null && b.addEventListener && (b.readyState = "loading", b.addEventListener("DOMContentLoaded", A = function() {
b.removeEventListener("DOMContentLoaded", A, 0), b.readyState = "complete"
}, 0)), a.yepnope = k(), a.yepnope.executeStack = h, a.yepnope.injectJs = function(a, c, d, e, i, j) {
var k = b.createElement("script"),
l, o, e = e || B.errorTimeout;
k.src = a;
for (o in d) k.setAttribute(o, d[o]);
c = j ? h : c || f, k.onreadystatechange = k.onload = function() {
!l && g(k.readyState) && (l = 1, c(), k.onload = k.onreadystatechange = null)
}, m(function() {
l || (l = 1, c(1))
}, e), i ? k.onload() : n.parentNode.insertBefore(k, n)
}, a.yepnope.injectCss = function(a, c, d, e, g, i) {
var e = b.createElement("link"),
j, c = i ? h : c || f;
e.href = a, e.rel = "stylesheet", e.type = "text/css";
for (j in d) e.setAttribute(j, d[j]);
g || (n.parentNode.insertBefore(e, n), m(c, 0))
}
}(this, document), Modernizr.load = function() {
yepnope.apply(window, [].slice.call(arguments, 0))
};
.tabs {
position: relative;
margin: 40px auto;
width: 750px;
}
.tabs input {
position: absolute;
z-index: 1000;
width: 120px;
height: 40px;
left: 0px;
top: 0px;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
cursor: pointer;
}
.tabs input#tab-2 {
top: 40px;
}
.tabs input#tab-3 {
top: 80px;
}
.tabs input#tab-4 {
top: 120px;
}
.tabs label {
background: #5ba4a4;
background: -moz-linear-gradient(top, #5ba4a4 0%, #4e8c8a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5ba4a4), color-stop(100%, #4e8c8a));
background: -webkit-linear-gradient(top, #5ba4a4 0%, #4e8c8a 100%);
background: -o-linear-gradient(top, #5ba4a4 0%, #4e8c8a 100%);
background: -ms-linear-gradient(top, #5ba4a4 0%, #4e8c8a 100%);
background: linear-gradient(top, #5ba4a4 0%, #4e8c8a 100%);
font-size: 15px;
line-height: 40px;
height: 40px;
position: relative;
padding: 0 20px;
display: block;
width: 80px;
color: #385c5b;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: bold;
text-align: right;
float: left;
clear: both;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.3);
border-radius: 3px 0 0 3px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
}
.tabs label:after {
content: '';
background: #fff;
position: absolute;
right: -2px;
top: 0;
width: 2px;
height: 100%;
}
.tabs input:hover+label {
background: #5ba4a4;
}
.tabs label:first-of-type {
z-index: 4;
}
.tab-label-2 {
z-index: 3;
}
.tab-label-3 {
z-index: 2;
}
.tab-label-4 {
z-index: 1;
}
.tabs input:checked+label {
background: #fff;
z-index: 6;
}
.clear-shadow {
clear: both;
}
.content {
background: #fff;
position: relative;
width: auto;
margin: -175px 0 0 120px;
height: 400px;
z-index: 5;
overflow: hidden;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
border-radius: 3px;
}
.content div {
position: absolute;
top: 0;
padding: 10px 40px;
z-index: 1;
opacity: 0;
-webkit-transition: all linear 0.5s;
-moz-transition: all linear 0.5s;
-o-transition: all linear 0.5s;
-ms-transition: all linear 0.5s;
transition: all linear 0.5s;
}
.content div {
-webkit-transform: translateY(-450px);
-moz-transform: translateY(-450px);
-o-transform: translateY(-450px);
-ms-transform: translateY(-450px);
transform: translateY(-450px);
}
.tabs input.tab-selector-1:checked~.content .content-1,
.tabs input.tab-selector-2:checked~.content .content-2,
.tabs input.tab-selector-3:checked~.content .content-3,
.tabs input.tab-selector-4:checked~.content .content-4 {
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-o-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
z-index: 100;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
-webkit-transition: all ease-out 0.3s 0.3s;
-moz-transition: all ease-out 0.3s 0.3s;
-o-transition: all ease-out 0.3s 0.3s;
-ms-transition: all ease-out 0.3s 0.3s;
transition: all ease-out 0.3s 0.3s;
}
.content div h2,
.content div h3 {
color: #398080;
}
.content div p {
font-size: 14px;
line-height: 22px;
font-style: italic;
text-align: left;
margin: 0;
color: #777;
padding-left: 15px;
font-family: Cambria, Georgia, serif;
border-left: 8px solid rgba(63, 148, 148, 0.1);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Animated Content Tabs with CSS3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Animated Content Tabs with CSS3" />
<meta name="keywords" content="tabs, css3, transition, checked, pseudo-class, label, css-only, sibling combinator" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link href="http://kasumov.pro/demo.css" rel="stylesheet" />
<link href="http://kasumov.pro/style4.css" rel="stylesheet" />
<script src="http://kasumov.pro/modernizr.custom.04022.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700,300,300italic' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<section class="tabs">
<input id="tab-1" type="radio" name="radio-set" class="tab-selector-1" checked="checked" />
<label for="tab-1" class="tab-label-1">About</label>
<input id="tab-2" type="radio" name="radio-set" class="tab-selector-2" />
<label for="tab-2" class="tab-label-2">Services</label>
<input id="tab-3" type="radio" name="radio-set" class="tab-selector-3" />
<label for="tab-3" class="tab-label-3">Work</label>
<input id="tab-4" type="radio" name="radio-set" class="tab-selector-4" />
<label for="tab-4" class="tab-label-4">Contact</label>
<div class="clear-shadow"></div>
<div class="content">
<div class="content-1">
<h2>About us</h2>
<p>You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out. Now, I don't know exactly when we turned on
each other, but I know that seven of us survived the slide... and only five made it out. Now we took an oath, that I'm breaking now. We said we'd say it was the snow that killed the other two, but it wasn't. Nature is lethal but it doesn't
hold a candle to man.</p>
<h3>How we work</h3>
<p>Like you, I used to think the world was this great place where everybody lived by the same standards I did, then some kid with a nail showed me I was living in his world, a world where chaos rules not order, a world where righteousness is not
rewarded. That's Cesar's world, and if you're not willing to play by his rules, then you're gonna have to pay the price. </p>
</div>
<div class="content-2">
<h2>Services</h2>
<p>Do you see any Teletubbies in here? Do you see a slender plastic tag clipped to my shirt with my name printed on it? Do you see a little Asian child with a blank expression on his face sitting outside on a mechanical helicopter that shakes when
you put quarters in it? No? Well, that's what you see at a toy store. And you must think you're in a toy store, because you're here shopping for an infant named Jeb.</p>
<h3>Excellence</h3>
<p>Like you, I used to think the world was this great place where everybody lived by the same standards I did, then some kid with a nail showed me I was living in his world, a world where chaos rules not order, a world where righteousness is not
rewarded. That's Cesar's world, and if you're not willing to play by his rules, then you're gonna have to pay the price. </p>
</div>
<div class="content-3">
<h2>Portfolio</h2>
<p>The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his
brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance
upon thee.</p>
<h3>Examples</h3>
<p>Now that we know who you are, I know who I am. I'm not a mistake! It all makes sense! In a comic, you know how you can tell who the arch-villain's going to be? He's the exact opposite of the hero. And most times they're friends, like you and
me! I should've known way back when... You know why, David? Because of the kids. They called me Mr Glass. </p>
</div>
<div class="content-4">
<h2>Contact</h2>
<p>You see? It's curious. Ted did figure it out - time travel. And when we get back, we gonna tell everyone. How it's possible, how it's done, what the dangers are. But then why fifty years in the future when the spacecraft encounters a black hole
does the computer call it an 'unknown entry event'? Why don't they know? If they don't know, that means we never told anyone. And if we never told anyone it means we never made it back. Hence we die down here. Just as a matter of deductive
logic.</p>
<h3>Get in touch</h3>
<p>Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows. Some pilots get picked
and become television programs. Some don't, become nothing. She starred in one of the ones that became nothing. </p>
</div>
</div>
</section>
</div>
</body>
</html>
Проблема решена следующим образом: помимо добавления вкладок в, непосредственно, самом HTML
, необходимо также добавить описание добавленных вкладок в CSS
. А именно, добавить блоки:.tabs input#tab-х
.tab-label-х
.tabs input.tab-selector-х:checked~.content .content-х
- где х
- номер соответствующей вкладки, при этом важно обратить внимание на пунктуацию!
Кофе для программистов: как напиток влияет на продуктивность кодеров?
Рекламные вывески: как привлечь внимание и увеличить продажи
Стратегії та тренди в SMM - Технології, що формують майбутнє сьогодні
Выделенный сервер, что это, для чего нужен и какие характеристики важны?
Современные решения для бизнеса: как облачные и виртуальные технологии меняют рынок
Пытаюсь проверить input, на значение value, при наличии в нем строки и безСтрока (Путь до файла), сразу же подгружается через callback или нажатием кнопки,...
Нужно, чтобы при нажатии на чекбокс все остальные кнопки убирались, а кнопка "применить" должна быть только у того чекбокса, который нажат...
Добрый деньПодскажите, пожалуйста, как в этом шаблоне отключить выпадающее меню в принципе на всех страницах