Hover-menu In Right Side Of Fixed Div
Solution 1:
No jQuery necessary, just give your #panel
a width:
#panel {
position: fixed;
width: 100%;
}
#settings {
float: right;
}
See DEMO.
Solution 2:
Aside from your example not being HTML, I would anyhow correct the conceptual approach. There is no jQuery required for such a task, which can be done entirely in CSS.
You want your
#panel
to first of all contain a<ul>
which will contain<li>
s, which will be your<panel-entry>
, those should be set asinline-block
.The
#settings
should be one of those, perhaps with a specialclass
orid
(we'll keep settings for now). You canposition: absolute
this toright: 0
, or have itfloat
. Don't use an image element for this, but rather use abackground-image
.Inside this element, you will have a submenu: i.e. another
<ul>
withdisplay: none
, aposition:absolute
,right: 0
andtop: X
, so that X doesn't overlap with your#panel
.Next, you want to make the element visible on
:hover
ofli#settings
.
Basic HTML
<divid="panel"><ul><li>Panel entry 1</li><li>Panel entry 2</li><li>Panel entry n</li><liid="settings"><ul><li>setting 1</li><li>setting 2</li><li>setting n</li></ul></li></ul></div>
Basic CSS
#panel {
position: fixed;
top: 0;
width: 100%;
}
#panel > ul > li {
display: inline-block;
}
#panel > ul > li > ul {
display: none;
position: absolute;
top: {X};
right: 0;
}
li#settings {
background: url({youricon}) no-repeat top center;
position: absolute;
right: 0;
min-width: {youricon-x};
min-height: {youricon-y};
}
li#settings:hover > ul{
display: block;
}
Post a Comment for "Hover-menu In Right Side Of Fixed Div"