add show list methods

Šis iesūtījums ir iekļauts:
Aleksey Chichenkov 2018-09-19 13:25:01 +03:00
vecāks 3478e04a63
iesūtījums bbb8ca5fdf
13 izmainītas datnes ar 929 papildinājumiem un 95 izdzēšanām

Apskatīt datni

@ -0,0 +1,65 @@
/**
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 9/19/18.
*/
window.onload = function () {
create();
};
function create() {
var hop = location.href.split("/").pop().split(".");
hop.pop();
var current_manager = hop[hop.length - 1];
var parent = hop[hop.length - 2];
var dropdown = document.querySelectorAll('.dropdown');
var dropdownArray = Array.prototype.slice.call(dropdown, 0);
dropdownArray.forEach(function (el) {
var button = el.querySelector('a.menu-title');
var menu = el.querySelector('.dropdown-menu');
if (!menu) return;
var arrow = button.querySelector('i.icon-arrow');
var item = menu.getAttribute("id");
var show = true;
var cur_parent = menu.parentNode.children[1] && menu.parentNode.children[1].getAttribute("id");
if (cur_parent) {
show = cur_parent != parent;
}
if (show && item == current_manager || parent && item == parent) {
menu.classList.add('show');
menu.classList.remove('hide');
arrow.classList.add('open');
arrow.classList.remove('close');
event.preventDefault();
}
button.onclick = function (event) {
var item = event.target.parentNode.children[1] && event.target.parentNode.children[1].getAttribute("id");
var current_page = item && item == current_manager;
if (!menu.hasClass('show')) {
menu.classList.add('show');
menu.classList.remove('hide');
arrow.classList.add('open');
arrow.classList.remove('close');
}
else {
menu.classList.remove('show');
menu.classList.add('hide');
arrow.classList.remove('open');
arrow.classList.add('close');
}
current_page && event.preventDefault();
};
});
Element.prototype.hasClass = function (className) {
return this.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(this.className);
};
}

Apskatīt datni

@ -0,0 +1,99 @@
*, *:before, *:after {
-webkit-border-sizing: border-box;
-moz-border-sizing: border-box;
border-sizing: border-box;
}
.ddm {
list-style: none;
padding: 0;
margin: 0 0 20px 0;
}
.dropdown a {
text-decoration: none;
}
.dropdown .menu-title {
position: relative;
display: block;
color: white;
background: #2980B9;
-moz-box-shadow: 0 1px 0 #409ad5 inset, 0 -1px 0 #20638f inset;
-webkit-box-shadow: 0 1px 0 #409ad5 inset, 0 -1px 0 #20638f inset;
box-shadow: 0 1px 0 #409ad5 inset, 0 -1px 0 #20638f inset;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
padding: 6px;
font-size: 20px;
}
.dropdown .menu-title:hover {
background: #2c89c6;
}
.dropdown .icon-arrow {
position: absolute;
display: block;
font-size: 0.7em;
color: #fff;
top: 10px;
right: 10px;
}
.dropdown .icon-arrow.open {
-moz-transform: rotate(-180deg);
-ms-transform: rotate(-180deg);
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
}
.dropdown .icon-arrow.close {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
.dropdown .icon-arrow:before {
content: '\25BC';
}
.dropdown .dropdown-menu {
max-height: 0;
overflow: hidden;
list-style: none;
padding: 0;
margin: 0;
}
.dropdown .dropdown-menu li {
padding: 0;
}
.dropdown .dropdown-menu li a {
display: block;
color: #232323;
background: #EEE;
-moz-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d5d5d5 inset;
-webkit-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d5d5d5 inset;
box-shadow: 0 1px 0 white inset, 0 -1px 0 #d5d5d5 inset;
text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
padding: 6px 10px;
}
.dropdown .dropdown-menu li a:hover {
background: #f6f6f6;
}
.dropdown .show, .dropdown .hide {
-moz-transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
}
.dropdown .show {
display: block;
max-height: 9999px;
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
.dropdown .hide {
max-height: 0;
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}

Apskatīt datni

@ -0,0 +1,4 @@
ul div.title {
font-size: 25px;
margin-bottom: 5px;
}

Apskatīt datni

@ -73,8 +73,10 @@ tt, code, kbd, samp {
}
#main {
float: left;
width: 75%;
float: right;
width: 85%;
box-sizing: border-box;
padding-left: 10px;
}
article dl {
@ -126,40 +128,40 @@ section
nav
{
display: block;
float: right;
margin-top: 28px;
width: 25%;
float: left;
width: 15%;
box-sizing: border-box;
border-left: 1px solid #ccc;
padding-left: 16px;
right: 0px;
border-right: 1px solid #ccc;
height: -webkit-fill-available;
position: fixed;
overflow: scroll;
overflow: auto;
padding-left: 16px;
padding-right: 16px;
}
nav ul {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
font-size: 100%;
line-height: 17px;
padding: 0;
margin: 0;
list-style-type: none;
}
/*nav ul {*/
/*font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;*/
/*font-size: 100%;*/
/*line-height: 17px;*/
/*padding: 0;*/
/*margin: 0;*/
/*list-style-type: none;*/
/*}*/
nav ul a, nav ul a:visited, nav ul a:active {
/*font-family: Consolas, Monaco, 'Andale Mono', monospace;*/
line-height: 18px;
color: #4D4E53;
}
/*nav ul a, nav ul a:visited, nav ul a:active {*/
/*!*font-family: Consolas, Monaco, 'Andale Mono', monospace;*!*/
/*line-height: 18px;*/
/*color: #4D4E53;*/
/*}*/
nav h3 {
margin-top: 12px;
}
/*nav h3 {*/
/*margin-top: 12px;*/
/*}*/
nav li {
margin-top: 6px;
}
/*nav li {*/
/*margin-top: 6px;*/
/*}*/
footer {
display: block;