我有这样的 css 规则:
#imgwrapper {display: block;position: relative;width:auto;height:auto;}
所以我得到一个超链接,当它被点击时,它应该像这样向#imgwrapper 添加一个 css 规则:
#imgtarget, #imgwrapper img {cursor:crosshair;}
我该怎么办??
我试过 jquery .css() api 但它不工作..
最佳答案
$('a.whatever').click(function() {
$('#imgtarget').css('cursor' , 'crosshair');
$('#imgwrapper img').css('cursor', 'crosshair');
});
关于jquery - 使用 jquery 添加 css 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14711066/