• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

想要实现开灯效果,应该怎么办呢?

那就要用到fadeTo() 方法

fadeTo()方法逐渐改变被选元素的不透明度为指定的值(褪色效果)。

代码:

!声明文档类型

html lang='en '

meta charset='UTF-8 '

标题文档/标题

脚本src=' jquery-3。4 .1 .js '/脚本

风格

部门{

宽度: 100px

高度: 200像素

border: 1px固体# 000

}

部门图像{

宽度: 100px

高度: 200像素

}

第一个孩子

显示:无;

}

/风格

/头

身体

氕点亮灯实例/h1

整点

输入类型='按钮'值='开灯'

差异

img src='image/on.png' alt=' '

img src='image/off.png' alt=' '

/div

脚本

$(function() {

$('输入')。单击(函数(){

$('img:last ').fadeOut('fast ',function() {

$('img:first ').fadeIn('slow ',function() {

$('输入')。val('灯亮了');

})

})

$('div ').fadeTo('1200 ',0.6);

})

})

/脚本

/body

/html

运行结果:

yhxttaix0sh3276.png

点击开灯后:

52rvg1okhvx3277.png

灯亮了!!!

案例所使用图片:

g2hdml3mch23278.png

0mqvek20opd3279.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now