简体   繁体   中英

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

<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.

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

Next, use JQuery to change cursor to default after content load.

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

Good luck !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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