animate 发布html,animate.html

animate

body{

width: 100%;

font-size: 14px;

background:#fff;

margin: 0px;

padding: 0px;

overflow: auto;

}

.container{

position: relative;

height: 1200px;

width: 1024px;

margin: 0px auto;

overflow: auto;

}

.left_ball,.right_ball{

position: absolute;

top:0px;

width:128px;

height:128px;

line-height: 128px;

text-align: center;

border-radius: 128px;

color: #fff;

}

.container .left_ball{

left:0px;

background: skyblue;

}

.container .right_ball{

right:0px;

background: pink;

}

左球
右球

function left(){

if($(this).scrollTop() <= 128 && $(this).scrollTop() > 64){

$(".left_ball").animate({left:'448px',top:'640px'},'fast',function(){

$(this).stop().fadeOut(500);

if($(window).scrollTop() <= 64 && $(window).scrollTop() >= 0){

$(this).fadeIn(500).animate({left:'0px',top:'0px',opacity: '1',display:'block'},

'slow',function(){

$(this).stop(false,true);

$(this).css("display","block");

left();

});

}

});

}

}

function right(){

if($(this).scrollTop() <= 128 && $(this).scrollTop() > 64){

$(".right_ball").animate({right:'448px',top:'640px'},'fast',function(){

$(this).stop().fadeOut(500);

if($(window).scrollTop() <= 64 && $(window).scrollTop() >= 0){

$(this).fadeIn(500).animate({right:'0px',top:'0px',opacity: '1',display:'block'}

,'slow',function(){

$(this).stop(false,true);

$(this).css("display","block");

right();

});

}

});

}

}

$(window).scroll(function(){

left();

right();

});

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值