返回jquery动......登陆

jquery动画

温度。2019-04-22 11:27:37209
<button id="right">右移</button>
<button id="stop">停止</button>
<div class="box1"> php中文网</div>

<script>
$(document).ready(function(){
          $('.but1').click(function(){
            $('p').animate({fontSize:'40px'},1500)//属性名称font-size 一律改成驼峰写法:fontSize
          })  
          //同时操作多个css属性
           //使用预定义的值 show hide toggle
           $('.but2').click(function(){
            $('div').animate({
              // left:'400px',//如果想对元素位置进行一个位移,那么我们需要给当前元素设置一个position例如:
              // opacity:'0.3',
              // height:'400px',
              // width:'400px'
              width:'toggle'
              },1500)     
          })
          $('#right').click(function(){
            $('.box1').animate({left:'+500px'},3000)
            $('.box1').animate({fontSize:'30px'},500)
          })
           $('#stop').click(function(){
            $('.box1').stop(true)
         }) 
         })
</script>

总结:animate使用前习惯性写上.stop(),立即完成动画,达到友好体验


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送