Rails 4: turbo-links change mouse cursor when loading

483 views Asked by At

when using rails 4 turbo-links, how do you change the mouse cursor to progress when a link is clicked?

i have tried this with no success:

application.js.erb

$(function() {
    $(window).ajaxStart(function() {
       $(this).css({'cursor' : 'progress'});
    }).ajaxStop(function() {
       $(this).css({'cursor' : 'default'});
    });
});

thanks!

1

There are 1 answers

0
amitben On

I found a jquery patch to help, although i wonder if there is a better solution..

in the mean time this thread helped me:

application.js.erb

$(function() {
    $(document).on('page:fetch',   function() { $('body').css( 'cursor', 'progress' ); });
    $(document).on('page:change',  function() { $('body').css( 'cursor', 'default' ); });
});