@defreshy

Почему не работает переключение табов?

Делаю по примеру
Но почему то не переключается между блоками, что делаю не так?
<section class="research">
	<div class="research-title">
		<h3>Исследования</h3>
	</div>
	<div class="research-content">
		<div data-features-tab class="research-text">
			<div id="research-text-1" class="research-text__block animated fadeIn __active">
				<h4>1</h4>
				<p>2</p>
				<a href="#">Узнать больше</a>
			</div>
			<div id="research-text-2" class="research-text__block animated fadeIn">
				<h4>2</h4>
				<p>2</p>
				<a href="#">Узнать больше</a>
			</div>
			<div id="research-text-3" class="research-text__block animated fadeIn">
				<h4>3</h4>
				<p>3</p>
				<a href="#">Узнать больше</a>
			</div>
			<div id="research-text-4" class="research-text__block animated fadeIn">
				<h4>4</h4>
				<p>4</p>
				<a href="#">Узнать больше</a>
			</div>
		</div>
		<div class="research-schema">
			<div data-features-nav class="research-schema__element">
				<div class="research-schema__button">
					<a href="#research-text-1" class="schema-icon-1 research-schema__icon __active"><span class="research-schema__text">1</span></a>
					<a href="#research-text-2" class="schema-icon-3 research-schema__icon"><span class="research-schema__text">2</span></a>
				</div>
				<div class="research-schema__animation">
					<span class="flash-oval">
					<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/flash.png" alt="pulse">
					<div class="wave hidden wave-anim"></div>
					<div class="wave2 hidden wave-anim"></div>
					<div class="wave3 hidden wave-anim"></div>
					<div class="wave4 hidden wave-anim"></div>
					</span>
				</div>
				<div class="research-schema__button">
					<a href="#research-text-3" class="schema-icon-4 research-schema__icon"><span class="research-schema__text">3</span></a>
					<a href="#research-text-4" class="schema-icon-6 research-schema__icon"><span class="research-schema__text">4</span></a>
				</div>
			</div>
		</div>
	</div>
</section>


h1, h2, h3, h4, h5 {
  margin: 0;
  padding: 0
}
html {
  display: block;
  position: relative;
  width: 100%;
  height: 100%
}
body {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  min-height: 100vh;
  background-color: #fff;
  color: #000;
  font-family: "Open Sans";
  font-size: 8px;
  line-height: 14px;
  -webkit-font-feature-settings: 'kern' 1;
  -o-font-feature-settings: 'kern' 1;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased
}
header,
section,
footer {
  display: block;
  position: relative;
  min-width: 880px
}
.research {
  display: block;
  position: relative;
  width: 860px;
  min-width: 860px;
  margin: 0 auto;
  text-align: center
}
.animated {
  -webkit-animation-duration: 1.5s;
  animation-duration: 2.5s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both
}
@-webkit-keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}
@keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}
.fadeIn {
  -webkit-animation-name: fadeIn;
  animation-name: fadeIn
}

.research .research-title {
  display: inline-block;
  position: relative;
  color: #404040;
  font-size: 32px;
  font-family: "Roboto";
  font-weight: 400;
  line-height: 46px;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 1em 0
}
.research .research-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.research .research-text__block {
  display: none;
  position: relative
}
.research .research-text__block.__active {
  display: block
}

.research .research-schema__element {
  height: 425px;
  margin: 25px
}
.research .research-schema__button {
  display: flex;
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  justify-content: center;
  -webkit-justify-content: center;
  align-items: center
}
.research-schema__animation {
  display: flex;
  justify-content: center;
  align-items: center
}
.research-schema__animation .flash-oval {
    background-color: #00bff3;
    width: 12em;
    height: 12em;
    border-radius: 7em;
    -webkit-transform: translateX(1px);
    -ms-transform: translateX(1px);
    transform: translateX(1px);
    z-index: 100;
    margin: 10em auto 9em auto
}
.research-schema__animation .flash-oval img {
    position: absolute;
    right: 32px;
    top: 23px;
}
.research .research-schema__button .research-schema__icon {
    display: block;
    width: 70px;
    height: 70px;
    background-color: #fff;
    border: 1px solid #9df;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -ms-border-radius: 10px;
    border-radius: 10px;
    transition-duration: 0.3s;
    background-position: center;
    background-repeat: no-repeat;
    line-height: 5em;
    z-index: 0;
    cursor: pointer;
    margin-left: 8%;
    margin-right: 8%;
    text-align: center;
    opacity: 0.5;
    filter: alpha(opacity=50)
}
.research .research-schema__button .research-schema__icon.__active {
    opacity: 1;
    filter: alpha(opacity=100)
}
.research .research-schema__button .research-schema__icon:hover {
    opacity: 1
}
.research .research-schema__button .research-schema__text {
    letter-spacing: 0;
    color: #656b6f;
    font-size: 11px;
    font-weight: 400;
    line-height: 16px;
    position: absolute;
    text-transform: uppercase
}

.research .research-schema__button .schema-icon-1:after {
    content: '';
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/top-left.svg);
    background-size: 100%;
    height: 110px;
    width: 85px;
    background-repeat: no-repeat;
    position: absolute;
    top: 36.4%
}
.research .research-schema__button .schema-icon-3:after {
    content: '';
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/top-right.svg);
    background-size: 100%;
    height: 110px;
    width: 85px;
    background-repeat: no-repeat;
    position: absolute;
    top: 36.4%;
    right: 10%
}
.research .research-schema__button .schema-icon-4:after {
    content: '';
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/bottom-left.svg);
    background-size: 100%;
    height: 110px;
    width: 85px;
    background-repeat: no-repeat;
    position: absolute;
    bottom: 26%
}
.research .research-schema__button .schema-icon-6:after {
    content: '';
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/bottom-right.svg);
    background-size: 100%;
    height: 110px;
    width: 85px;
    background-repeat: no-repeat;
    position: absolute;
    bottom: 26%;
    right: 10%
}
.research .research-schema__button .schema-icon-1 {
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/icon-6.svg);
    background-size: 65%;
    background-position: 50% 50%
}
.research .research-schema__button .schema-icon-3 {
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/icon-3.svg);
    background-size: 65%
}
.research .research-schema__button .schema-icon-4 {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/icon-1.svg);
    background-size: 150%;
    background-position: 50% 0;
}
.research .research-schema__button .schema-icon-6 {
    background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/598117/icon-5.svg);
    background-size: 150%
}

.hidden {display:none;}
.visible {display:block;}


.research .research-schema__element {
    height: 425px;
    margin: 25px
}
.research .research-schema__element .research-schema__button {
    display: flex;
    display: -webkit-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    justify-content: center;
    -webkit-justify-content: center;
    align-items: center
}
.research .research-schema__element .research-schema__animation {
    display: flex;
    justify-content: center;
    align-items: center
}
.research .research-schema__element .flash-oval {
    background-color: #00bff3;
    width: 12em;
    height: 12em;
    border-radius: 7em;
    -webkit-transform: translateX(1px);
    -ms-transform: translateX(1px);
    transform: translateX(1px);
    z-index: 100;
    margin: 10em auto 9em auto
}
.research .research-schema__element .flash-oval img {
    position: absolute;
    right: 33px;
    top: 25px;
}

(function() {
var selectors = {
nav: '[data-features-nav]',
tabs: '[data-features-tabs]',
active: '.__active'
}
var classes = {
active: '__active'
}
$('a', selectors.nav).on('click', function() {
let $this = $(this)[0];
$(selectors.active, selectors.nav).removeClass(classes.active);
$($this).addClass(classes.active);
$('div', selectors.tabs).removeClass(classes.active);
$($this.hash, selectors.tabs).addClass(classes.active);
return false
});
}());

$(".research-schema__icon").on("click", function() {
$(".wave-anim").addClass('visible').one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd", function() {
$(".wave-anim").removeClass('visible');
});
});
  • Вопрос задан
  • 116 просмотров
Решения вопроса 1
Ankhena
@Ankhena Куратор тега CSS
Нежно люблю верстку
tabs: '[data-features-tabs]',
а в разметке data-features-tab
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
15 нояб. 2024, в 23:33
20000 руб./за проект
15 нояб. 2024, в 23:11
1000 руб./за проект
15 нояб. 2024, в 23:07
8000 руб./за проект