0
我的問題是這樣的 - 我在一個網站上創建了一個頂欄橫幅,通過鼠標懸停在桌面上。在移動設備上,當您點擊該橫幅時,橫幅會拉下 - 如果您在頁面上點擊橫幅以外的任何地方,則橫幅會恢復。當您再次單擊該橫幅時,需要將該橫幅消失,而不必點擊頁面使其消失。如何在點擊移動設備時更改橫幅位置?
這是我目前的CSS:
aside.banner-container {
width: 100%;
height: 150px;
background: #000;
border-bottom: 1px solid rgba(255,255,255,0.6);
position: absolute;
top: -135px;
cursor: pointer;
margin: 0px auto;
padding-bottom: 10px;
-webkit-transition: top 1s ease;
-moz-transition: top 1s ease;
transition: top 1s ease;
z-index: 999;
}
.banner-container:hover, .banner-container:focus, .banner-container:active {
position: absolute;
top: 0px;
}
JSP頁面是否有差別。研究我可以在Javascript中看到onClick事件,但是如果我告訴定位是「top:-135px」,onClick是否會與首次點擊發生混淆?或不,因爲這是從技術上懸停?
很棒,謝謝!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :) –