Html/jQuery:使div消失并在下面使用Canvas
Html/jQuery: Make div disappear and use Canvas underneath
我有一个 canvas 刮刮卡游戏,我想在上面放 'play' 图像,当按下它时图像应该消失,用户可以开始玩。
我的图像消失了大约 1/2 秒,然后又出现了。这可能是我不太擅长的 CSS 魔法。
感谢任何帮助
<div id="canvasImage" class="col-1-2">
<div class="play-hover">
<img id="img"class="img-hover"src="resource/images/play.png"
onclick="prices()">
</img>
</div>
<script>
$(function() {
$(document).on("click",function (e) {
if (e.target.id=="img") {
$("#canvas").fadeToggle(200);
e.stopPropagation();
return false;
}
});
});
</script>
<canvas id="canvas"></canvas>
<script>
this.go = function(data){
$(function(){
var canvas = document.getElementById("canvas");
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
var scratch_layer = new ScratchMask(canvas, "resource/images/paris.png", canvas.width,
canvas.height, data,
function(){
console.log("success2");
}
);
$(".loading").remove();
})
}
$(document).ready(function() {
setTimeout(function(){$("#canvasImage").fadeOut(1500); } ,3000);
});
你能用上面的解决方案吗setTimeOut
功能会根据你提到的时间自动消失图像
我有一个 canvas 刮刮卡游戏,我想在上面放 'play' 图像,当按下它时图像应该消失,用户可以开始玩。
我的图像消失了大约 1/2 秒,然后又出现了。这可能是我不太擅长的 CSS 魔法。
感谢任何帮助
<div id="canvasImage" class="col-1-2">
<div class="play-hover">
<img id="img"class="img-hover"src="resource/images/play.png"
onclick="prices()">
</img>
</div>
<script>
$(function() {
$(document).on("click",function (e) {
if (e.target.id=="img") {
$("#canvas").fadeToggle(200);
e.stopPropagation();
return false;
}
});
});
</script>
<canvas id="canvas"></canvas>
<script>
this.go = function(data){
$(function(){
var canvas = document.getElementById("canvas");
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
var scratch_layer = new ScratchMask(canvas, "resource/images/paris.png", canvas.width,
canvas.height, data,
function(){
console.log("success2");
}
);
$(".loading").remove();
})
}
$(document).ready(function() {
setTimeout(function(){$("#canvasImage").fadeOut(1500); } ,3000);
});
你能用上面的解决方案吗setTimeOut
功能会根据你提到的时间自动消失图像