我創建了一個下拉式登錄表單,但是一旦jQuery正常工作,我會在左側顯示菜單(當登錄時在右側)。有些圖片清楚地看到它:我的下拉菜單沒有在父母的下方顯示
當我 '登錄' 點擊:
它加載這種方式。下面的代碼:
HTML:
<div id="navthing">
<h2><a href="#" id="loginform">Log in</a> | <a href="#">Sign Up</a></h2>
<div class="login">
<div class="arrow-up"></div>
<div class="formholder">
<div class="randompad">
<fieldset>
<label name="email">Email</label>
<input type="email" value="[email protected]" />
<label name="password">Password</label>
<input type="password" />
<input type="submit" value="Login" />
</fieldset>
</div>
</div>
</div>
</div>
和CSS:
#navthing {
text-align: right;
padding: 0.5em;
}
.login {
position: absolute;
width:250px;
display:none;
z-index: 9999;
}
.formholder {
background: #ecf0f1;
width: 250px;
border-radius: 5px;
padding-top: 5px;
z-index: 1;
display:block;
}
.arrow-up {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 15px solid #ECF0F1;
left: 10%;
position: absolute;
top: -10px;
}
.formholder input[type="email"], .formholder input[type="password"] {
padding: 7px 5px;
margin: 10px 0;
width: 96%;
display: block;
font-size: 18px;
border-radius: 5px;
border: none;
-webkit-transition: 0.3s linear;
-moz-transition: 0.3s linear;
-o-transition: 0.3s linear;
transition: 0.3s linear;
}
.formholder input[type="email"]:focus, .formholder input[type="password"]:focus {
outline: none;
box-shadow: 0 0 1px 1px #1abc9c;
}
.formholder input[type="submit"] {
background: #1abc9c;
padding: 10px;
font-size: 20px;
display: block;
width: 100%;
border: none;
color: #fff;
border-radius: 5px;
}
.formholder input[type="submit"]:hover {
background: #1bc6a4;
}
.randompad {
padding: 10px;
}
.green {
color: #1abc9c;
}
a {
color: #ecf0f1;
text-decoration: none;
}
a:hover {
color: #1abc9c;
}
我得到了.login
的position
在absolute
,因爲如果不是菜單進行的darkblue
DIV大。如何在「登錄」下顯示菜單(箭頭和表格的其餘部分)?我嘗試但沒有結果。謝謝。
可以使小提琴? –
請給出完整的代碼或製作它的片段。 –
它顯示在這裏:https://jsfiddle.net/gx35L38z/ – Jim