• <i id='v7O9O'><tr id='v7O9O'><dt id='v7O9O'><q id='v7O9O'><span id='v7O9O'><b id='v7O9O'><form id='v7O9O'><ins id='v7O9O'></ins><ul id='v7O9O'></ul><sub id='v7O9O'></sub></form><legend id='v7O9O'></legend><bdo id='v7O9O'><pre id='v7O9O'><center id='v7O9O'></center></pre></bdo></b><th id='v7O9O'></th></span></q></dt></tr></i><div id='v7O9O'><tfoot id='v7O9O'></tfoot><dl id='v7O9O'><fieldset id='v7O9O'></fieldset></dl></div>

      • <bdo id='v7O9O'></bdo><ul id='v7O9O'></ul>

      <small id='v7O9O'></small><noframes id='v7O9O'>

        <legend id='v7O9O'><style id='v7O9O'><dir id='v7O9O'><q id='v7O9O'></q></dir></style></legend>

        <tfoot id='v7O9O'></tfoot>
      1. Draggable JS Bootstrap modal - 性能问题

        Draggable JS Bootstrap modal - performance issues(Draggable JS Bootstrap modal - 性能问题)
          <tbody id='ERFhe'></tbody>

          1. <small id='ERFhe'></small><noframes id='ERFhe'>

            <tfoot id='ERFhe'></tfoot>

                <legend id='ERFhe'><style id='ERFhe'><dir id='ERFhe'><q id='ERFhe'></q></dir></style></legend>

                • <bdo id='ERFhe'></bdo><ul id='ERFhe'></ul>
                • <i id='ERFhe'><tr id='ERFhe'><dt id='ERFhe'><q id='ERFhe'><span id='ERFhe'><b id='ERFhe'><form id='ERFhe'><ins id='ERFhe'></ins><ul id='ERFhe'></ul><sub id='ERFhe'></sub></form><legend id='ERFhe'></legend><bdo id='ERFhe'><pre id='ERFhe'><center id='ERFhe'></center></pre></bdo></b><th id='ERFhe'></th></span></q></dt></tr></i><div id='ERFhe'><tfoot id='ERFhe'></tfoot><dl id='ERFhe'><fieldset id='ERFhe'></fieldset></dl></div>
                • 本文介绍了Draggable JS Bootstrap modal - 性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对于工作中的项目,我们使用 JavaScript 中的 Bootstrap 模态窗口.我们想让一些窗口可以移动,但是我们遇到了 JQuery 的性能问题.

                  For a project at work we use Bootstrap Modal windows in JavaScript. We would like to make some of the windows movable, but we are running into performance issues with JQuery.

                  $("#myModal").draggable({
                      handle: ".modal-header"
                  });
                  

                  示例 ,
                  来源 .
                  在 IE9 中,它按预期工作.
                  在 Chrome 中,水平拖动按预期工作,垂直拖动相当慢但没有问题.
                  在 Firefox 中,水平拖动按预期工作,但垂直拖动非常慢.

                  Example ,
                  Source .
                  In IE9, it works as expected.
                  In Chrome, horizontal dragging works as expected, and vertical dragging is rather slow but not problematic.
                  In Firefox, horizontal dragging works as expected, but vertical dragging is extremely slow.

                  这很奇怪,因为示例窗口在图形上并不繁重,而且 JQuery 应该规范浏览器行为.我尝试不使用 JQuery 的可拖动来解决这个问题,但我遇到了同样的问题.

                  It's strange, because the example window is not graphically heavy and JQuery is supposed to normalize browser behavior. I tried solving this without using JQuery's draggable, but I ran into the same issue.

                  所以我有几个问题:

                  • 性能缓慢是浏览器、JQuery、Bootstrap 的问题还是我的代码不是最优的?
                  • 为什么水平和垂直拖动有区别?
                  • 我应该找到一种解决方法,还是完全避免使用 Bootstrap 来处理动态弹出窗口?

                  亲切的问候,圭多

                  推荐答案

                  我找到了一些方法来解决这个问题.

                  I found a few ways to fix this.

                  将此添加到您的 CSS 文件将在拖动模态时禁用 transition 效果.然而,似乎一旦用户拖动框,飞入将不会正确发生,而是会淡入.

                  Adding this to your CSS file will disable the transition effects while the modal is being dragged. It appears however that once the user drags the box the fly in will not occur correctly but rather it will just fade in.

                  .modal.fade.ui-draggable-dragging {
                      -moz-transition: none;
                      -o-transition: none;
                      -webkit-transition: none;
                      transition: none;
                  }
                  

                  或者将以下内容添加到您的 CSS 文件和 nofly 类到您的模型将一起禁用飞入,但不会淡入:

                  Alternatively adding the following to your CSS file and the nofly class to your model will disable the fly in all together but not the fade in:

                  .modal.fade.nofly {
                      top: 10%;        
                      -webkit-transition: opacity 0.3s linear;
                      -moz-transition: opacity 0.3s linear;
                      -o-transition: opacity 0.3s linear;
                      transition: opacity 0.3s linear;
                  }
                  

                  这篇关于Draggable JS Bootstrap modal - 性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  How to upload image into HTML5 canvas(如何将图像上传到 HTML5 画布中)
                  How to show a running progress bar while page is loading(如何在页面加载时显示正在运行的进度条)
                • <i id='4Oogl'><tr id='4Oogl'><dt id='4Oogl'><q id='4Oogl'><span id='4Oogl'><b id='4Oogl'><form id='4Oogl'><ins id='4Oogl'></ins><ul id='4Oogl'></ul><sub id='4Oogl'></sub></form><legend id='4Oogl'></legend><bdo id='4Oogl'><pre id='4Oogl'><center id='4Oogl'></center></pre></bdo></b><th id='4Oogl'></th></span></q></dt></tr></i><div id='4Oogl'><tfoot id='4Oogl'></tfoot><dl id='4Oogl'><fieldset id='4Oogl'></fieldset></dl></div>

                      <tbody id='4Oogl'></tbody>
                      <legend id='4Oogl'><style id='4Oogl'><dir id='4Oogl'><q id='4Oogl'></q></dir></style></legend>

                      <small id='4Oogl'></small><noframes id='4Oogl'>

                      • <tfoot id='4Oogl'></tfoot>
                            <bdo id='4Oogl'></bdo><ul id='4Oogl'></ul>