2

I am developing a webapp using phonegap for android .I m using jquery mobile tap event and for each tap event i want to show a loading div before displaying the content.I am seeing a delay between the tap event and display of loading div. Below is snippet of the code I have written

    $('#events').bind('tap',function () {           
        document.getElementById("loadingDiv").style.display = "block";  
       });

and this my loadingDiv

<div id="loadingDiv"></div>

#loadingDiv {position: fixed; background:black url('images/ajax-loader.gif') no-repeat center 20%; height:100%; width:100%; z-index:100000;}

And also for speeding up the Jquery mobile I have turned off the transitions as well.

Please guide me on How to display the loadingDiv immediately for a nice user experience.

4

1 回答 1

0

假设 jQuery 移动点击事件被正确调用。这听起来像是浏览器需要一段时间才能实际显示到元素的问题。

由于 'display: none'未包含在渲染树中,当您将其更改为阻止浏览器时,可能需要一段时间才能执行此操作。

一些解决方案是将元素设置为“不透明度:0”并将其设置为“不透明度:1”(或者是可见性属性)。这样做意味着元素会影响布局,但由于您使用的是固定位置,这应该不是问题。

于 2013-03-20T14:49:14.287 回答