我有幾個按鈕出現在我的帖子下。其中一個按鈕是社交分享按鈕,當您將鼠標懸停在其上時,會出現社交分享菜單。問題是我無法進入菜單,因爲一旦我的鼠標脫離主分享按鈕,它就會消失。我有一個30px的邊距,所以我認爲這是造成這個問題。但我不知道如何解決它,因爲我想要30px的邊距。有沒有人有任何解決方案?懸停下拉菜單消失之前,我可以點擊它
這裏是一個粗略的小提琴(不完全一樣,但我的你的想法) -
<div class="wrap">
<img class="main-share button" src="http://amandoblogs.com/wp-content/uploads/2014/08/share-e1408475480528.png" />
<div class="share-buttons">
<a href="http://twitter.com/home/?status=Love this post by @ <?php the_title(); ?> - <?php the_permalink(); ?>" target="_blank" title="Tweet this!"><img src="https://www.theclimategroup.org/sites/all/modules/custom/tcg_social_media_icons/icons/black/16x16/twitter.png"></a>
<a href="http://www.facebook.com/sharer.php?url=<?php the_permalink(); ?>" target="_blank">
<img src="http://www.shipwreckmuseum.com/wp-content/themes/shipwreckmuseum/assets/facebook-icon.png" alt="Facebook" />
</a>
<a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">
<img src="https://lh4.googleusercontent.com/-FaD4j4FL1Bc/TuEf9aN1gEI/AAAAAAAABek/kVqztZRwJ1w/s128/Pinterest_Favicon.png" alt="Pinterest" />
</a>
<a href="http://www.facebook.com/sharer.php?url=<?php the_permalink(); ?>" target="_blank">
<img src="http://www.ihatestevensinger.com/osafe_theme/images/user_content/images/icon-heart.png" alt="Heart" />
</a>
</div>
</div>
,當你將鼠標懸停在分享按鈕如何煤礦實際上看起來
.wrap:hover .share-buttons {
display:block;
position: absolute;
left: 50%;
white-space: nowrap;
margin-left:-34px;
}
.wrap:hover .triangle-share {
display:block;
position: absolute;
white-space: nowrap;
}
.share-buttons {
display: none;
letter-spacing: 15px;
background-color:#efefef;
padding:10px 20px;
margin-top:30px;
}
.main-share-button {
}
.triangle-share {
border-bottom: 12px solid #efefef;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
width: 0;
height: 0;
margin-top:18px;
margin-left:8px;
content: "";
display: none;
}
.wrap {
display: inline-block;
}
請編輯您的代碼片段,它看起來不像包含的圖片,也不像您所描述的那樣運行。 – Shaggy
它仍然有同樣的問題。當您將鼠標懸停在分享按鈕上時,會出現菜單。但是,由於一旦鼠標移出分享按鈕,填充就會消失。 – user6738171
嘗試在您的**分享按鈕中使用'margin-top:-5px;'** css class – warl0ck