-
Notifications
You must be signed in to change notification settings - Fork 5
/
_suckerfish.scss
62 lines (53 loc) · 1.36 KB
/
_suckerfish.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* SCSS port of CSS at http://htmldog.com/articles/suckerfish/dropdowns/ */
/* Built with compass http://www.compass-style.org */
/* Generates the styles for suckerfish dropdowns */
/*
Pass in the parameters $topLevelWidth and $lowerLevelWidth. The former controls the width of the first level,
i.e. the visible level. The lower level is the width of the sub-levels, which get exposed on hover.
Call this mixin with @import suckerfish(topLevelWidth, lowerLevelWidth), then style it as needed.
To override any of these styles, place your code after the @import directive.
For IE 6 compatibility, you must add javascript that attaches .sfhover class to mouseover.
This will handle up to three levels of dropdowns.
Be sure to minify before deploying to production.
*/
@mixin suckerfish($topLevelWidth, $lowerLevelWidth) {
ul {
list-style-type: none;
padding: 0;
margin: 0;
line-height: 1;
}
a {
display: block;
width: $topLevelWidth;
}
li {
float: left;
width: $topLevelWidth;
&:hover, &.sfhover {
ul {
left:auto;
li {
float: none;
display: block;
}
ul {
left: -999em;
}
}
}
li:hover, li.sfhover {
ul {
left: auto;
}
}
ul {
position: absolute;
width: $lowerLevelWidth;
left: -999em;
ul {
margin: -1em 0 0 $lowerLevelWidth;
}
}
}
}