python特效源代码,python 轮播效果源代码

轮播效果

*{

margin: 0px ;

padding: 0px;

}

body {

background: green;

}

.box{

width: 600px;

height: 400px;

margin: 50px auto;

overflow:hidden;

position: relative;

}

.ctrl{

width: 50px;

height: 50px;

color: red;

font-size: 50px;

text-align:center;

line-height:50px;

background: none;

border: none;

outline: none;

cursor: pointer;

position: absolute;

z-index: 10;

top:40%;

display: none;

}

.next {

right:0;

}

.content{

width: 1800px;

height: 400px;

position: relative;

left:-600px;

}

img {

display: block;float: left;

width: 600px;

height: 400px;

}

.dot{

width:100%;

height: 50px;

background: aqua;

position: relative;

bottom: 50px;

text-align: center;

line-height: 50px;

}

.dot div {

display: inline-block;

width: 14px;

height: 14px;

background: white;

border: 1px solid red;

border-radius: 8px;

}

.dot .selected{

background: purple;

font-weight: bold;

}

<

>

03.jpg#写你自己的图片路径就可以了01.jpg

02.jpg

var index=0$('.box').hover(function() {

$('.ctrl').show(300)

},function() {

$('.ctrl').hide(300)

})//prev 按钮

$('.prev').click(function() {//若内容正在动画,则立即返回

if ($('.content').is(':animated')){return}

$('.content').animate({left:0},'slow','linear',function() {//动画结束后,将最后一张图查到最开头

$('.content').prepend($('img:last'))//重新设置偏移

$('.content').css('left','-600px')//记录图片序号

if(--index==-1){

index=2}

$('.dot div').eq(index).addClass('selected').siblings().

removeClass('selected')

})

$('.dot div').eq(index).click()

})//next 按钮

$('.next').click(function() {//若内容正在动画,则立即返回

if ($('.content').is(':animated')){return}

$('.content').animate({left:'-1200px'},'slow','linear',function() {//动画结束后,将最后一张图查到最开头

$('.content').append($('img:first'))//重新设置偏移

$('.content').css('right','-600px')if(++index==3) {

index=0}

$('.dot div').eq(index).addClass('selected').siblings().

removeClass('selected')

})

})

})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值