Skip to content

Commit 5439465

Browse files
authored
refactor: do not close the menu, if you switch between menu and sub-menu (#23)
* configure hover-delay ... ... via e.g.: "data-dropdown-hover-delay=500" * [+]: fix for "bounds === undefined" [+]: do not close the menu, if you switch between menu and sub-menu * [*]: sync the code-style * [*]: sync the code-style v2 * [+]: keep css if "auto !important" is used * Update bootstrap-dropdownhover.js * Update bootstrap-dropdownhover.css
1 parent 7e0caab commit 5439465

File tree

2 files changed

+473
-281
lines changed

2 files changed

+473
-281
lines changed

css/bootstrap-dropdownhover.css

Lines changed: 83 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
/*!
1+
/* --------------------------------------------------------- */
2+
/*
23
* Dropdownhover v1.0.0 (http://bs-dropdownhover.kybarg.com)
34
*/
4-
.dropdown .dropdown-menu .caret {
5-
border: 4px solid transparent;
6-
border-left-color: #000;
7-
float: right;
8-
margin-top: 6px;
9-
}
10-
.dropdown-menu {
11-
min-width: 250px;
12-
}
13-
.dropdown-menu > li.open > a {
14-
background-color: #F5F5F5;
15-
color: #262626;
16-
text-decoration: none;
17-
}
18-
.dropdown-menu .dropdown-menu {
19-
left: 100%;
20-
margin: 0;
21-
right: auto;
22-
top: -1px;
23-
}
24-
.dropdown-menu-right .dropdown-menu,
25-
.navbar-right .dropdown-menu .dropdown-menu,
26-
.pull-right .dropdown-menu .dropdown-menu {
27-
left: auto;
28-
right: 100%;
5+
/* --------------------------------------------------------- */
6+
7+
/**
8+
* add animation for bootstrap "dropdown-menu"
9+
*
10+
* @see:
11+
* Animation duration: http://www.w3schools.com/cssref/css3_pr_animation-duration.asp
12+
* Animation timing: http://www.w3schools.com/cssref/css3_pr_animation-timing-function.asp
13+
*/
14+
15+
.dropdown > a {
16+
-webkit-transition: all 0.2s ease-in;
17+
-o-transition: all 0.2s ease-in;
18+
-moz-transition: all 0.2s ease-in;
19+
transition: all 0.2s ease-in;
2920
}
21+
3022
.dropdown-menu.animated {
3123
-webkit-animation-duration: 0.3s;
32-
animation-duration: 0.3s;
24+
-moz-animation-duration: 0.3s;
25+
-o-animation-duration: 0.3s;
26+
animation-duration: 0.3s;
27+
-webkit-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);;
28+
-moz-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);;
29+
-o-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);;
30+
animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);;
3331
}
3432
.dropdown-menu.animated:before {
3533
content: " ";
@@ -41,33 +39,71 @@
4139
width: 100%;
4240
z-index: 99;
4341
}
44-
.dropdownhover-top {
45-
margin-bottom: 2px;
46-
margin-top: 0;
47-
}
48-
.navbar-fixed-bottom .dropdown-menu .dropdown-menu,
49-
.dropdownhover-top .dropdown-menu {
50-
bottom: -1px;
51-
top: auto;
52-
}
5342

54-
.navbar-nav > li > .dropdown-menu {
55-
margin-bottom: 0;
43+
.dropdown-menu.animated.fadeIn {
44+
-webkit-animation-duration: 0.2s;
45+
-moz-animation-duration: 0.2s;
46+
-o-animation-duration: 0.2s;
47+
animation-duration: 0.2s;
48+
-webkit-animation-timing-function: ease-out;
49+
-moz-animation-timing-function: ease-out;
50+
-o-animation-timing-function: ease-out;
51+
animation-timing-function: ease-out;
5652
}
5753

5854
.dropdownhover-bottom {
59-
-webkit-transform-origin: 50% 0;
60-
transform-origin: 50% 0;
55+
-webkit-transform: translate3d(0, 0, 0);
56+
-moz-transform: translate3d(0, 0, 0);
57+
-ms-transform: translate3d(0, 0, 0);
58+
-o-transform: translate3d(0, 0, 0);
59+
transform: translate3d(0, 0, 0);
60+
/* <-- use the GPU for the rendering */
61+
-webkit-transform-origin: 50% 0;
62+
-moz-transform-origin: 50% 0;
63+
-ms-transform-origin: 50% 0;
64+
-o-transform-origin: 50% 0;
65+
transform-origin: 50% 0;
6166
}
67+
6268
.dropdownhover-left {
63-
-webkit-transform-origin: 100% 50%;
64-
transform-origin: 100% 50%;
69+
-webkit-transform: translate3d(0, 0, 0);
70+
-moz-transform: translate3d(0, 0, 0);
71+
-ms-transform: translate3d(0, 0, 0);
72+
-o-transform: translate3d(0, 0, 0);
73+
transform: translate3d(0, 0, 0);
74+
/* <-- use the GPU for the rendering */
75+
-webkit-transform-origin: 100% 50%;
76+
-moz-transform-origin: 100% 50%;
77+
-ms-transform-origin: 100% 50%;
78+
-o-transform-origin: 100% 50%;
79+
transform-origin: 100% 50%;
6580
}
81+
6682
.dropdownhover-right {
67-
-webkit-transform-origin: 0 50%;
68-
transform-origin: 0 50%;
83+
-webkit-transform: translate3d(0, 0, 0);
84+
-moz-transform: translate3d(0, 0, 0);
85+
-ms-transform: translate3d(0, 0, 0);
86+
-o-transform: translate3d(0, 0, 0);
87+
transform: translate3d(0, 0, 0);
88+
/* <-- use the GPU for the rendering */
89+
-webkit-transform-origin: 0 50%;
90+
-moz-transform-origin: 0 50%;
91+
-ms-transform-origin: 0 50%;
92+
-o-transform-origin: 0 50%;
93+
transform-origin: 0 50%;
6994
}
95+
7096
.dropdownhover-top {
71-
-webkit-transform-origin: 50% 100%;
72-
transform-origin: 50% 100%;
73-
}
97+
-webkit-transform: translate3d(0, 0, 0);
98+
-moz-transform: translate3d(0, 0, 0);
99+
-ms-transform: translate3d(0, 0, 0);
100+
-o-transform: translate3d(0, 0, 0);
101+
transform: translate3d(0, 0, 0);
102+
/* <-- use the GPU for the rendering */
103+
-webkit-transform-origin: 50% 100%;
104+
-moz-transform-origin: 50% 100%;
105+
-ms-transform-origin: 50% 100%;
106+
-o-transform-origin: 50% 100%;
107+
transform-origin: 50% 100%;
108+
}
109+

0 commit comments

Comments
 (0)