我有一些HTML和CSS代碼,除了IE10及其以外的瀏覽器,其他瀏覽器都可以很好地工作,令人驚喜。基本上,有一個用戶個人資料頁面及其個人資料圖片(頭像)。如何防止IE使用子元素阻塞懸停觸發器?
當您將鼠標懸停在頭像上時,某些CSS會告訴頭像div中的div,將不透明度從0更改爲不透明度1.在該div內部,有一個Tweet按鈕 - 使用iframe和Socialite,嵌入,但這無關緊要。
在IE中發生的事情是,您將鼠標懸停在頭像上,並且該按鈕將按照其意圖顯示,除非您將鼠標懸停在Tweet按鈕上,則會「阻止」光標位於頭像div之上,這會導致它消失。這是一個IE怪癖,它不應該這樣做,因爲外部觸發器div是其中所有內容的父代。
下面是使用Handlebars:
<div class="profile-avatar" style="background-image:url({{avatar_url}})">
<div class="avatar-overlay">
<div class="tweet-profile">
<a href="//twitter.com/share" class="socialite twitter-share" data-count="none" data-text="Check out my profile!" data-url="{{url}}" rel="nofollow" target="_blank"></a>
</div>
</div>
</div>
HTML和這裏的CSS(它Stylus,所以稍微剝開語法):
.profile-avatar
@extend .background-cover
height 120px
margin-bottom 10px
position relative
&:hover
.avatar-overlay
opacity 1
.tweet-profile
position absolute
top 50px
left 32px
&:hover
opacity 1
.avatar-overlay
position absolute
left 0px
top 0px
width 100%
height 100%
background-color rgba(0,0,0,0.5)
opacity 0
transition opacity 250ms
手寫筆!我的眼睛! gaahhhh他們燃燒!哪裏有一些水把它們拿出來,哦,這裏是SASSssssssss – Jason