当ajax响应收到时,为什么marquee会延迟

时间:2012-10-10 10:35:09

标签: javascript html jquery

我有一个选框,它在我的网络应用程序中滚动动态数据,停止一点开始再次滚动,就像有人停止它并再次拖动其他ajax响应接收和更新html页面中的数据时的行为。这是marquee标签的问题吗?

<marquee scrollamount="1" scrolldelay="10">
    <span id="HPQ" class="syPrice">22.20</span>
    <span id="APQ" class="ayPrice">12.20</span>
    <span id="BPQ" class="byPrice">18.10</span>
    <span id="CPQ" class="cyPrice">65.20</span>
    <span id="DPQ" class="dyPrice">87.56</span>
    <span id="EPQ" class="eyPrice">15.24</span>
    <span id="FPQ" class="fyPrice">34.45</span>
    <span id="GPQ" class="gyPrice">16.20</span>
</marquee>

我的ajax调用响应也会不断更新此页面。

function dataUpdate(){
          $.ajax({
                  type : "GET",
                   url : '../myJsonData.xhtml',
                  dataType : "json",
                  async : true,
                  cache : false,

                  success: function(data) {
                     $.each(data, function(i, item) {
                      /* updates data here */
                     });
                  setTimeout('dataUpdate()',1000);
                  },
                  error : function() {
              }
             });
          }   

我以类似上面的ajax调用

的方式更新选取框数据

1 个答案:

答案 0 :(得分:1)

不,这不是特定于marquee标签的问题。

浏览器在用户界面中一次只做一件事。只要脚本正在运行,页面中就没有任何更新。

如果您有任何其他移动元素,例如动画GIF,您会看到在脚本运行时它们也会暂停一段时间。