在不活动时更改启动引导轮播中的超时

时间:2019-02-27 06:48:18

标签: html twitter-bootstrap

我在触摸屏环境中有一个旋转木马,并且我需要检测用户何时触摸图像以停止旋转木马的运动。此外,一旦过了一段时间,请再次启动轮播。有可能吗?

代码在jsFiddle上,这里:https://jsfiddle.net/7p30d2um/

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Test</h2>  
  <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
      <div class="item active">
        <img src="https://lcsc.academyofmine.com/wp-content/uploads/2017/06/Test-Logo.svg.png" alt="Los Angeles" style="width:100%;">
      </div>

      <div class="item">
        <img src="https://static.careers360.mobi/media/article_images/2018/01/03/NATA-Mock-Test.jpg" alt="Chicago" style="width:100%;">
      </div>

      <div class="item">
        <img src="https://wow.olympus.eu/webfile/img/1632/x=1024/oly_testwow_stage.jpg" alt="New york" style="width:100%;">
      </div>
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>

</body>
</html>

预先感谢

0 个答案:

没有答案