使用JQuery css方法的自定义CSS游标 [英] Custom CSS cursor using JQuery css method

查看:92
本文介绍了使用JQuery css方法的自定义CSS游标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法可以使用JQuery的.css()方法来提供以下光标样式?:

Is there a way I can use JQuery's .css() method to give the following cursor style?:

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


推荐答案

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()?

这篇关于使用JQuery css方法的自定义CSS游标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆