简体   繁体   English

如何使用jQuery Flip为div设置动画

[英]How to animate div using jQuery Flip

My code is working fine when the user triggers a mouse over event, however I want to set a timer to animate without any trigger - like auto animating. 当用户触发鼠标悬停事件时,我的代码工作正常,但是我想将计时器设置为没有任何触发的动画-例如自动动画。 How can I do that? 我怎样才能做到这一点?

$(document).ready(function() {
  $(".flip").flip({
    axis: 'y',
    trigger: 'hover'
  });
});
<div class=" flip  col-md-3">
  <div class="flip">
    <div class="front">
      <div class="title">Front Wise</div>
    </div>
    <div class="back">
      <div class="title">Back Wise</div>
    </div>
  </div>
</div>

This is the library: https://nnattawat.github.io/flip/ 这是库: https : //nnattawat.github.io/flip/

You need to set the trigger value to manual , check the doc 您需要将触发值设置为manual ,检查文档

$(".flip").flip({
    axis: 'y',
    trigger: 'manual'
});

setTimeout( function() {
  $(".flip").flip('toggle');
}, 100); //this will trigger the flip after 100 millisecond

Demo 演示

 $(document).ready(function() { $(".flip").flip({ axis: 'y', trigger: 'manual' }); setTimeout(function() { $(".flip").flip('toggle'); }, 5000); //this will trigger the flip after 100 millisecond }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.js"></script> Flip below will be triggered in 5 seconds <div class=" flip col-md-3"> <div class="flip"> <div class="front"> <div class="title">Front Wise</div> </div> <div class="back"> <div class="title">Back Wise</div> </div> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM