简体   繁体   English

我的混合模式代码片段有问题吗?

[英]Is there something wrong with my mix-blend-mode code snippet?

I've been trying emulate (in Webflow) this nifty 'fluid text hover' from the following codepen: https://codepen.io/robin-dela/pen/KKPYoBq我一直在尝试从以下代码笔中模拟(在 Webflow 中)这个漂亮的“流体文本悬停”: https://codepen.io/robin-dela/pen/KKPYoBq

As you can see, there is a fair amount of HTML, CSS (SCSS) and JS (Babel), but I believe the pertinent code snippet to be the following:如您所见,有相当数量的 HTML、CSS (SCSS) 和 JS (Babel),但我相信相关的代码片段如下:

<style>
body {
    position: fixed;
    height: 100%;
  overflow: hidden;
}

canvas {
    position: absolute;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
}

.mask {
    position: absolute;
    z-index: 2;
    background: white;
    height: 100vh;
    width: 100vw;
    mix-blend-mode: screen;
    /* THE mix-blend-mode ABOVE DISPLAYS IN RED */
}

svg {
    width: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

</style>

When I publish my site, the 'CREATIVE' text displays, but without the interactive fluid element.当我发布我的网站时,会显示“创意”文本,但没有交互式流体元素。 I'm almost certain it's something to do with the mix-blend-mode, as that is the only code showing up in red.我几乎可以肯定这与混合混合模式有关,因为这是唯一以红色显示的代码。 I've seen similar questions asked on here, and have tried all the methods offered (changing the body background to white, as opposed to transparent; adding the code as a code block rather than the Inside tag, but nothing has as yet made it work. I'd really appreciate any help.我在这里看到过类似的问题,并尝试了所有提供的方法(将主体背景更改为白色,而不是透明;将代码添加为代码块而不是内部标记,但尚未实现工作。我真的很感激任何帮助。

My Webflow site read-only can be found here: https://preview.webflow.com/preview/hen-ry?utm_medium=preview_link&utm_source=designer&utm_content=hen-ry&preview=f7f278a8af346d820c843647397c8d76&pageId=6238983c269c21e6d0507afe&workflow=preview My Webflow site read-only can be found here: https://preview.webflow.com/preview/hen-ry?utm_medium=preview_link&utm_source=designer&utm_content=hen-ry&preview=f7f278a8af346d820c843647397c8d76&pageId=6238983c269c21e6d0507afe&workflow=preview

You're probably missing the js file.您可能缺少 js 文件。 If you click the little settings button at the top of the JS section, you will see a file called https://robindelaporte.fr/codepen/bundle.js , if you have not loaded this then it won't work.如果您单击 JS 部分顶部的小设置按钮,您将看到一个名为https://robindelaporte.fr/codepen/bundle.js的文件,如果您没有加载它,那么它将无法工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM