2017-10-19 21 views

回答

2

它看起來像你的刪除按鈕可能覆蓋容器,即它是一個Z索引問題。是否將足夠高的z-index添加到.fixed-content幫助中?

.fixed-content { 
    z-index: 9999; 
} 

如果沒有,你可以張貼一些周圍的HTML,所以我們可以創建一個小提琴,看看/解決實際問題?

0

要滾動距離後固定在div是> 100像素:

<div id="header"></div> 

<style> 
#header { 
    background-color: #f90; 
    height: 50px; 
    left: 0; 
    position: absolute; 
    top: 100px; 
    width: 100%; 
} 

#header.sticky { 
    position: fixed; 
    top: 0; 
} 
</style> 

<script> 
function header_sticky() { 
    var header = document.getElementById('header'); 
    if (window.scrollY >= 100) { 
     header.className = 'sticky'; 
    } else { 
     header.className = ''; 
    } 
} 
window.addEventListener('load', header_sticky, false); 
window.addEventListener('scroll', header_sticky, false); 
</script> 

DEMO