首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在bootstrap 3模式中对中spin.js微调器?

如何在bootstrap 3模式中对中spin.js微调器?
EN

Stack Overflow用户
提问于 2013-09-14 06:04:13
回答 1查看 42.2K关注 0票数 17

我试图在Bootstrap 3模式下显示spin.js微调器并使其居中。使用下面的代码,我让它在IE和FF中工作,但不能在Chrome,Safari Desktop,Chrome IOS,Safari IOS中工作。

这个问题似乎与动画中的淡入淡出(灰色背景覆盖)有关,因为当我将fade类设置为“fade show”时,它可以正常工作,但当然不会在动画中淡出。请参阅此jsfiddle。当我使用"$('#Searching_Modal").modal('show');“时,它在上面描述的一些浏览器中不起作用。

在chrome和火狐上运行这个jsfiddle,你就会明白我的意思了。有没有人知道怎么解决这个问题,或者正确地做这个事情?我确实希望bootstrap模式淡入工作。

我使用的是Bootstrap 3和spin.js。

<div id="Searching_Modal" class="modal fade" tabindex="-1" role="dialog" data-keyboard="false"
 data-backdrop="static">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header" style="text-align: center">
            <h3>Searching for Seats</h3>
        </div>
        <div class="modal-body">
            <br>
            <br>
            <br>

            <div id="searching_spinner_center" style="position:fixed; left:50%"></div>
            <br>
            <br>
            <br>
        </div>
        <div class="modal-footer" style="text-align: center"></div>
    </div>
</div>

以下是spin.js设置代码:

var opts = {
  lines: 13, // The number of lines to draw
  length: 20, // The length of each line
  width: 10, // The line thickness
  radius: 30, // The radius of the inner circle
  corners: 1, // Corner roundness (0..1)
  rotate: 0, // The rotation offset
  direction: 1, // 1: clockwise, -1: counterclockwise
  color: '#000', // #rgb or #rrggbb or array of colors
  speed: 1, // Rounds per second
  trail: 60, // Afterglow percentage
  shadow: false, // Whether to render a shadow
  hwaccel: false, // Whether to use hardware acceleration
  className: 'spinner', // The CSS class to assign to the spinner
  zIndex: 2e9, // The z-index (defaults to 2000000000)
  top: 'auto', // Top position relative to parent in px
  left:'auto' // Left position relative to parent in px
};
//var target = document.getElementById('center_spinner');
var target = document.getElementById('searching_spinner_center');
var spinner = new Spinner(opts).spin(target);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-14 06:55:54

尝试将div.mode-body替换为

<div class="modal-body" >
   <div style="height:200px">
      <span id="searching_spinner_center" style="position: absolute;display: block;top: 50%;left: 50%;"></span>
    </div>
</div>

为我工作吧。http://jsfiddle.net/D6rD6/5/

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

https://stackoverflow.com/questions/18795967

复制
相关文章

相似问题

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