有没有办法使用 JQuery 的 .css() 方法来提供以下光标样式?:
cursor: url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), default !important;
jQuery 不理解!important
,所以如果你删除它就会起作用:
$('selector').css({
'cursor': 'url(http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur), default'});
有很多方法可以解决这个问题,为什么不使用 CSS 类呢?
/* CSS */
.cursor {
cursor: url('http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur'), default !important;
}
所以你可以:
$('selector').addClass('cursor');
还有其他替代方案,请参阅:如何使用 .css() 来应用 !important ? https://stackoverflow.com/questions/2655925/jquery-css-applying-important-styles
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)