我一直在一个网站上工作,因此决定向其添加暗模式功能,我使用darkmode.js库实现了该库,该库基于原理工作mix-blend-mode: difference。但是,当我使用IntersectionObserver向其中添加滚动动画并启用了暗模式时,应该显示的div变成白色,然后立即变成黑色。是的,看起来似乎很复杂,所以
这是我的代码
const targets = document.querySelectorAll('.animate');
const options = {
threshold: 0.7
}
const lazyLoad = target => {
const io = new IntersectionObserver((entries, observer) => {
console.log(entries)
entries.forEach(entry => {
console.log('');
if (entry.isIntersecting) {
const img = entry.target;
img.classList.add('fade');
observer.disconnect();
}
}, options)
}, options);
io.observe(target)
};
targets.forEach(lazyLoad);Run Code Online (Sandbox Code Playgroud)
.quotes-layout {
margin-top: 50px;
display: flex;
justify-content: center;
margin-left: 10%;
margin-right: 10%;
}
.quote {
flex: 1;
margin-right: 20px;
text-align: left;
background: #eee;
padding: 20px 20px;
}
.quote …Run Code Online (Sandbox Code Playgroud)javascript css difference mix-blend-mode intersection-observer
gatsby build我的 gatsby 项目工作正常,并且也有 404 页面,但是我在成功完成构建过程后或在成功完成构建过程后打开浏览器时收到错误:
Building static HTML for pageserror: Error: ENOENT: no such file or directory
Run Code Online (Sandbox Code Playgroud)
如果我在这段时间内没有收到错误,gatsby build那么我必须在运行时进入浏览器gatsby serve并打开浏览器:
Error: ENOENT: no such file or directory, stat '/project/public/404.html'
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Terraform 中签出 git repo 代码并访问其中的文件 (my_file.py),我使用了下面的代码,
module "my_git_repo" {
source = "https://git.mycompany.org/my_repo.git"
}
Run Code Online (Sandbox Code Playgroud)
输出:
"my_display" {
value = "${my_git_repo.source}/my_file.py"
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是,错误:无法下载模块下载“https://git.mycompany.org/my_repo.git”:没有返回源 URL
注意:我可以使用命令“git clone”进行结账。
我有一个允许出租车预订的 html 表单,但它不应该允许及时预订!所以时间必须是当前或未来。
这是表格,我使用 datetime-local。
/* Here is the JavaScript validation for the datetime-local. */
var dateTime = document.getElementById("dateTime").value;
if (dateTime == "" || dateTime == null) {
booking.dateTime.focus();
document.getElementById("dateMessage").innerHTML = "Please select a date AND time, thankyou.";
return valid = false;
} else {
document.getElementById("destinationMessage").innerHTML = "";
}Run Code Online (Sandbox Code Playgroud)
```
<form id="booking" action="">
<div id="firstNameMessage" class="red"></div>
<span class="red">*</span>First Name:
<input type="text" name="firstName" id="firstName">
<br>
<div id="lastNameMessage" class="red"></div>
<span class="red">*</span>Last Name:
<input type="text" name="lastName" id="lastName">
<br>
<div id="numberMessage" class="red"></div>
<span class="red">*</span>Contact …Run Code Online (Sandbox Code Playgroud)flask-jwt-extended当我将装饰器token_in_blacklist_loader添加到我的代码中时,我遇到了这个奇怪的错误。这是错误:
Traceback (most recent call last):
File "home/app.py", line 42, in <module>
@jwt.token_in_blacklist_loader
AttributeError: 'JWTManager' object has no attribute 'token_in_blacklist_loader'
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
@jwt.token_in_blacklist_loader
def check_if_token_is_revoked(decrypted_token):
jti = decrypted_token['jti']
token_in_redis = jwt_redis_blacklist.get(jti)
return token_in_redis is not None
Run Code Online (Sandbox Code Playgroud)
预先感谢您的宝贵反馈!
我有一个包含几个问题的表格。一些问题有一组子问题。这些是使用以下代码呈现的。
{
Object.keys(this.props.moduleDetails.questions).map((questionInfo, index) => (
<div key={index}>
<QuestionAnswers
questionInfo={this.props.moduleDetails.questions[questionInfo]}
generateStepData={this.props.generateStepData}
states={this.props.states}
userEnteredValues={this.props.formValues}
errors={this.props.errors}
setQuestionAnswers={this.setQuestionAnswers}
/>
{this.props.moduleDetails.questions[questionInfo].question_group &&
this.props.moduleDetails.questions[questionInfo].has_grouped_questions ===
1 ? (
<div className="sub-questions">
{this.props.moduleDetails.questions[questionInfo].question_group ? (
<span>
{this.renderQuestionGroup(questionInfo)}
<input
type="button"
onClick={e => {
this.addQuestionGroup(questionInfo)
}}
value="Add"
className="btn"
/>
</span>
) : null}
</div>
) : null}
</div>
))
}
Run Code Online (Sandbox Code Playgroud)
如您所见,问题组是使用 renderQuestionGroup(questionInfo) 方法呈现的。
renderQuestionGroup(questionInfo) {
let input = [];
this.state.groupedQuestions[questionInfo] = (this.state.groupedQuestions[questionInfo]) ?
this.state.groupedQuestions[questionInfo]
: [];
let answerId = this.props.formValues[questionInfo];
let groupedQuestions = this.props.moduleDetails.questions[questionInfo].question_group[answerId];
if((groupedQuestions != null && this.state.groupedQuestions[questionInfo].length …Run Code Online (Sandbox Code Playgroud) 我有一个包含多个选项卡(子项)的页面。我还更改了每个选项卡的 URL,但我仍在父页面上,只是更改选项卡的 URL。
问题是当我单击选项卡时,我无法保持父页面 NavLink 处于活动状态,因为它更改了 URL,但我想在选项卡 URL 上保持活动状态。
这该怎么做?
从“反应”导入反应;从'react-router-dom'导入{导航链接};
export default () => {
return (
<>
<nav className='Navigation'>
<ul className={`Navigation__list ${hide}`}>
<li className='Navigation__list-item'>
<NavLink to="/events" >Events</NavLink>
</li>
</ul>
</nav>
<Tabs />
</>
);
}
Run Code Online (Sandbox Code Playgroud)
// 标签组件作为子组件
export default function Tabs () => (
<ul className="events__tab">
<li> <NavLink to="/events"> All Events </NavLink> </li>
<li> <NavLink to="/myevents"> My Events </NavLink> </li>
</ul>
)
Run Code Online (Sandbox Code Playgroud)
提前感谢您的支持!
React.lazy在 Gatsby 中使用时,您会在制作production( gatsby build)时出错React.lazy,suspense在 Gatsby 项目中使用和使用的最佳方法是什么
我在启动 Docker 容器时遇到了困难,它在控制台中显示了一些奇怪的错误,因为我是新手,所以我对它的线索为零:
Dockerfile:
FROM node:14
WORKDIR /usr/src/app/
COPY package.json package.json
COPY server.js server.js
RUN ping -c 4 google.com
RUN npm config set registry https://registry.npmjs.com/
RUN echo "${http_proxy}" && echo "${HTTP_PROXY}"
RUN npm install
# COPY . .
EXPOSE 3000
CMD ['npm', 'start']
Run Code Online (Sandbox Code Playgroud)
当我运行 docker build 命令时
$ docker build -t myapp .
Run Code Online (Sandbox Code Playgroud)
我收到的错误:
Sending build context to Docker daemon 947.7kB
Step 1/7 : FROM node:14
---> 7bef16bb2cf1
Step 2/7 : WORKDIR /usr/src/app/
---> Using cache
---> 90402606c386
Step 3/7 …Run Code Online (Sandbox Code Playgroud) 我试图访问test()内部的返回值,__constructor()但我坚持了下来。任何人都可以告诉我有关如何从中获取返回值的信息__constructor()。感谢您的回答!
class some
{
public function __construct()
{
$this->test(); // I want this test()
}
public function test()
{
return 'abc';
}
}
$some = new some;
echo $some;
print_r($some);
Run Code Online (Sandbox Code Playgroud)
我自己尝试过,但没有任何反应!
谢谢!