且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用JQuery css方法的自定义CSS游标

更新时间:2022-12-11 13:10:01

jQuery不理解!重要,所以如果你删除它就行了:

jQuery doesn't understand the !important, so if you remove that it'll work:

$('selector').css({
    'cursor': 'url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), default'}); 

有很多方法可以解决它,为什么不使用CSS类?

There are ways to get around it, why not use a CSS class?

/* CSS */
.cursor {
    cursor: url('http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur'), default !important;
}

所以你可以:

$('selector').addClass('cursor');

还有其他选择,请参阅:如何申请!重要的是使用.css()?

There are other alternatives too, see: How to apply !important using .css()?