57 lines
932 B
HTML
Executable file
57 lines
932 B
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
|
|
.menu ul {
|
|
margin: 0;
|
|
list-style: none;
|
|
padding-left: 20px;
|
|
|
|
display: none;
|
|
}
|
|
|
|
.menu .title {
|
|
padding-left: 16px;
|
|
font-size: 18px;
|
|
cursor: pointer;
|
|
|
|
background: url(http://js.cx/clipart/arrow-right.png) left center no-repeat;
|
|
}
|
|
|
|
.menu-open .title {
|
|
background: url(http://js.cx/clipart/arrow-down.png) left center no-repeat;
|
|
}
|
|
|
|
.menu-open ul {
|
|
display: block;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="sweeties" class="menu">
|
|
<span id="sweeties-title" class="title">Сладости (нажми меня)!</span>
|
|
<ul>
|
|
<li>Торт</li>
|
|
<li>Пончик</li>
|
|
<li>Пирожное</li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var titleElem = document.getElementById('sweeties-title');
|
|
|
|
titleElem.onclick = function() {
|
|
var menu = this.parentNode;
|
|
menu.classList.toggle('menu-open');
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|