The top of the product details page with the scroll bar becomes opaque transparent

<div class="i-gd-header" id="header" style="background: rgba(255,255,255,0)">
    <div class="i-gd-header-left" onclick="closeWindiw(isApp)"><i class="iconfont icon-fanhui"></i></div>
    <div class="i-gd-header-center">商品详情</div>
    <div class="i-gd-header-right">
        <div class="iconfont icon-xin"></div>
        <div class="iconfont icon-fenxiang3"></div>
    </div>
</div>
.i-gd-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 91;
    width: 100%;
    background-color: #fff;
    display: flex;
    align-items: center;
    font-size: 14px;
    height: 45px;
}

.i-gd-header-left {
    width: calc(30% - 20px);
    padding: 0 10px;
}

.i-gd-header-left i {
    font-weight: bold;
    color: #333;
}

.i-gd-header-center {
    text-align: center;
    width: 40%;
    font-size: 16px;
    color: rgba(0,0,0,0);
}

.i-gd-header-right {
    width: calc(30% - 20px);
    padding: 0 10px;
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
}

.i-gd-header-right .iconfont{
    color: #fff;
    font-size: 16px;
    z-index: 99;
    background: #666;
    margin-left: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
            $ (Document) .scroll ( function () {
                 var scroH = $ (Document) .scrollTop ();   // rolling height 
                var the nums = scroH / 500; // exceeds the height from the top 500px completely opaque 
                $ ( "i-. Center-header-Gd. ") CSS (" Color ", 'RGBA (0,0,0,' the nums + + ')' ); 
                $ ( " Gd-.i-header ") CSS (." background ", ' RGBA (255,255,255, 'the nums + +') ' ); 
                $ ( "Gd-.i-header-right .iconfont") CSS ( "background",.' RGBA (102, 102, 102, '+ (. 1 - the nums) + ')' ); 
$ ( . ".i-Gd-header-right .iconfont") CSS ( "Color", 'RGB (' + (255 - ((255 - 102) / 2) * the nums) + ' '+(255 - ((255 - 102)/2)*nums)+', '+(255 - ((255 - 102)/2)*nums)+')');
            });

 

Guess you like

Origin www.cnblogs.com/shark1100913/p/12002466.html