小编Gol*_*are的帖子

CSS过滤器转换

我的疑问是:每当我第一次按任何按钮时,图像会在4秒内成功转换到所需的过滤器.但是当我按下另一个按钮时,转换会在没有4秒的情况下立即发生.每次按下按钮,如何在4秒内更改图片?

function change_image() {
  document.getElementById("blur").style.filter = "sepia(1)";
}

function change_image_2() {
  document.getElementById("blur").style.filter = "grayscale(100%)";
}

function change_image_3() {
  document.getElementById("blur").style.filter = "blur(5px)";
}
Run Code Online (Sandbox Code Playgroud)
#blur {
  transition-duration: 4s;
}
Run Code Online (Sandbox Code Playgroud)
<div id="blur">
  <img src="http://placehold.it/300" alt="whatever" height="400" width="300">
</div>
<br>
<button class="btn btn-success" type="button" onclick="change_image()">Sepia</button>
<button class="btn btn-success" type="button" onclick="change_image_2()">Grayscale</button>
<button class="btn btn-success" type="button" onclick="change_image_3()">Blur</button>
Run Code Online (Sandbox Code Playgroud)

html javascript css

6
推荐指数
1
解决办法
661
查看次数

继承不起作用

从我的代码我希望我的卧室类继承超级类房间的长度和宽度.我在评论中填写了相应行中的错误.我收到错误,我找不到出路.请帮帮我?

package index;

public class Room {
int length;
int breadth;

Room(int x,int y)
{
    length = x;
    breadth = y;
}
int area(){
    return (length*breadth);
}
}

class BedRoom extends Room{      //Implicit super constructor Room() is undefined for default constructor. Must define an explicit constructor
    int height;
    public void Bedroom(int x,int y,int z)
    {
        super(x,y);    //Constructor call must be the first statement in a constructor
        height=z;
    }


int volume(){
    return (length*breadth*height);
    }
}
class InherTest
{
    public static void …
Run Code Online (Sandbox Code Playgroud)

java

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

标签 统计

css ×1

html ×1

java ×1

javascript ×1