Сообщение от yaparoff
|
Что не так?
|
Тестировать нужно свой код...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<!--
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
.features {
width: 350px;
margin: 0 auto;
border-left: 1px solid gray;
border-right: 1px solid gray;
}
.features li {
border-top: 1px solid gray;
}
.features li:last-child {
border-bottom: 1px solid gray;
}
.feature-name {
font-size: 20px;
padding: 10px 0;
cursor: pointer;
text-align: center;
}
.feature-name:hover {
background-color: gray;
color: #fff;
-webkit-transition: 0.45s;
transition: 0.45s;
}
.feature-wrapper {
position: absolute;
left: -9999px;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
cursor: default;
visibility: hidden;
}
.feature-wrapper.visible {
position: fixed;
visibility: visible;
left: 0;
}
.feature-description {
position: relative;
width: 500px;
margin: 300px auto 0;
padding: 20px;
background-color: #fff;
border-radius: 20px;
text-align: center;
}
.feature-description .close {
position: absolute;
top: 10px;
right: 13px;
color: #6d6d6d;
cursor: pointer;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
</style>
<script type='text/javascript'>
</script>
</head>
<body>
<ul class="features">
<li>
<div class="feature-name">hash</div>
<div class="feature-wrapper">
<div class="feature-description">
<!-- <div class="close">X</div>-->
<h3>hash</h3>
<p>часть URL содержащая якори</p>
<p><i>location.hash</i></p>
</div>
</div>
</li>
<li>
<div class="feature-name">search</div>
<div class="feature-wrapper">
<div class="feature-description">
<!-- <div class="close">X</div>-->
<h3>hash</h3>
<p>часть URL содержащая якори</p>
<p><i>location.hash</i></p>
</div>
</div>
</li>
</ul>
<script type='text/javascript'>
var features = document.querySelector('.features');
features.addEventListener('click', function(event) {
var target = event.target;
// var close = target.classList.contains('close');
// if (target.classList.contains('feature-description') && !close) break;
while(target != features) {
alert(target.classList.contains('feature-name'))
if (target.classList.contains('feature-name')) {
var o=target.querySelector('.feature-wrapper');
alert(o)
o.classList.toggle('visible');
break;
}
}
});
</script>
</body>
</html>