除了一个问题,我还有一个问题,但我找不到解决方案。
我有这个HTML:
<section class="section" id="section-2">
<div class="wrapper" id="wrapper">
<div class="slider-container" id="slider-container">
<figure class="panel-image">
<img src="imgs/projects/3d-particles-image.png">
</figure>
<figure class="panel-image">
<img src="imgs/projects/3d-particles-image.png">
</figure>
</div>
</div>
</section>
Run Code Online (Sandbox Code Playgroud)
而这个CSS:
.wrapper {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
.slider-container {
position: absolute;
width: 100%;
height: 100%;
}
.panel-image {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
line-height: 100%;
}
.panel-image > img { ????????? }
Run Code Online (Sandbox Code Playgroud)
我需要将img放置在图中,但“ panel-image”的位置必须是绝对的。有什么建议么?
非常感谢!
我有一个名为Box的画布"对象",当鼠标悬停在它上面时我需要检测.
我有一个这个对象的draw()方法,我使用isPointInPath()方法,但只有当光标在最后一个路径上时才会改变.有什么建议?
Box.prototype.draw = function() {
this.ctx.beginPath();
this.ctx.moveTo(this.matrix.p1.x, this.matrix.p1.y);
this.ctx.lineTo(this.matrix.p2.x, this.matrix.p2.y);
this.ctx.lineTo(this.matrix.p3.x, this.matrix.p3.y);
this.ctx.lineTo(this.matrix.p4.x, this.matrix.p4.y);
this.ctx.lineTo(this.matrix.p1.x, this.matrix.p1.y);
this.ctx.closePath();
this.ctx.fillStyle = 'rgba(255, 255, 255, 0.1)';
this.ctx.fill();
if (this.ctx.isPointInPath(mouse.x, mouse.y)) {
this.canvas.style.cursor = 'pointer';
this.ctx.fillStyle = 'rgba(0, 0, 255, 0.5)';
this.ctx.fill();
return;
}
this.canvas.style.cursor = 'default';
};
Run Code Online (Sandbox Code Playgroud)