简体   繁体   English

jQuery允许光标在document.ready函数之前前进

[英]Jquery allow cursor to progress before document.ready function

In my project i want the cursor to progress state before document ready function and after the entire page is rendered it need to change the cursor to default state. 在我的项目中,我希望光标在文档准备功能之前进入状态,并且在呈现整个页面之后需要将光标更改为默认状态。

 (function($) {
    $('body').css('cursor','progress');  
    $(document).ready(function() {
    $('body').css('cursor','progress'); }

This my code can anyone please help me out 这是我的代码,谁能帮助我

What you could do is something like this add a css rule for the body cursor 您可以做的是像这样为body光标添加一个css规则

<style>
html {
  cursor: progress;
}
<style>

then just change the cursor again when page finish rendering all the contents. 然后只需在页面完成呈现所有内容后再次更改光标即可。

$(window).on('load',function() {
    $('html').css('cursor','default'); 
}

At first, declare CSS style on head tag for force the cursor to waiting. 首先,在head标签上声明CSS样式,以强制光标等待。

<style>
html {
  cursor: progress;
}
<style>

Next, use JQuery to change cursor to default after content load. 接下来,在内容加载后,使用JQuery将光标更改为默认值。

$(document).ready(function() {
    $('html').css('cursor','default'); 
}

Good luck ! 祝好运 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM