首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在X秒后执行jQuery翻转

问在X秒后执行jQuery翻转
EN

Stack Overflow用户
提问于 2015-12-03 13:51:55
回答 3查看 994关注 0票数 0

与"css供应商前缀“的斗争,但无法使它在所有的设备上工作。现在,让我们尝试一种称为jQuery翻转的jQuery解决方案。

它在触发器上工作得很好:“悬停”和“单击”,但是根据这里找到的文档,触发器“手册”需要通过JavaScript激活:http://nnattawat.github.io/flip/。

那么,我的问题是:如何在3秒后编写javascript来激活翻转函数?

代码:

代码语言:javascript
复制
<head>
<style type="text/css">
  .card {
    width: 600px;
    height: 400px;
    margin: 20px;
  }
  .front, .back {
    border: 2px gray solid;
    padding: 10px;
  }
  .front {
    background-color: #ccc;
  }
  .back {
    background-color: red;
  }
</style>
</head>
<body>
<div id="card-1" class="card">
  <div class="front">
      Front: Cursus aliquet mus et sociis, placerat adipiscing a placerat magnis integer nisi lacus in, turpis porttitor? Lectus nunc dis in porta, montes lacus. Tortor. Pid sit nisi eu nec aenean.
  </div>
  <div class="back">
      <a href="http://google.com">link</a>
      Back: Dolor scelerisque ridiculus! Mus? Augue, montes, montes proin rhoncus vel a parturient dapibus eros? Penatibus nascetur. In turpis nisi elementum nascetur habitasse augue egestas, in ac rhoncus odio porttitor turpis.
  </div>
</div>

<script type="text/javascript">
$(function(){
  // $(".card").flip();

  $("#card-1").flip({
    axis: "y", // y or x
    reverse: false, // true and false
    trigger: "manual", // click, hover or manual
    speed: 500
  });
});
</script>
</body>

提前感谢!

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2015-12-03 14:01:24

使用setTimeout()来实现这一点。

代码语言:javascript
复制
$(function(){

    $("#card-1").flip({
        axis: "y", // y or x
        reverse: false, // true and false
        trigger: "manual", // click, hover or manual
        speed: 500
    });

    setTimeout(function(){
        $("#card-1").flip(true);
    }, 3000);

});
票数 0
EN

Stack Overflow用户

发布于 2015-12-03 13:57:30

试着使用以下方法:

代码语言:javascript
复制
setTimeout(function() { yourFunction(); }, 3000);
票数 0
EN

Stack Overflow用户

发布于 2015-12-03 13:58:04

尝试使用超时3秒:

代码语言:javascript
复制
$(function(){

    $("#card-1").flip({
        axis: "y", // y or x
        reverse: false, // true and false
        trigger: "manual", // click, hover or manual
        speed: 500
    });

    setTimeout(function() {
        $('.card').flip();
    },3000);

});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34067787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档