小编Pah*_*Pow的帖子

使用 CSS 屏蔽 div

好吧,假设我正在为我的 div 使用以下设置:

.background将包含一个图像。 .overlay会有一个半透明的白色背景作为覆盖层, .inner会有效地屏蔽掉 div 大小的矩形吗?使背景透明并穿过覆盖层 div。

<div class="background">
    <div class="overlay">
        <div class="inner">
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

只用CSS可以实现吗?

html css mask masking

8
推荐指数
1
解决办法
3万
查看次数

具有偏移量的平滑滚动锚点(jquery)

我使用以下代码为我的站点上的锚添加平滑滚动。因为我有一个粘性标头ID,想将其偏移200像素

$('a[href*="#"]:not([href="#"])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        if (target.length) {
            $('html, body').animate({
                scrollTop: target.offset().top
            }, 1000);
            return false;
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery scroll anchor-scroll

2
推荐指数
1
解决办法
3538
查看次数

标签 统计

anchor-scroll ×1

css ×1

html ×1

javascript ×1

jquery ×1

mask ×1

masking ×1

scroll ×1