0

是否有可能更改css-cursor特定组(图像)的所有对象的属性,如果它们z-index<= 0?我不确定这是否可以在没有循环的情况下完成。

也许只使用选择器。如果您能给我一个提示,那就太好了。

4

2 回答 2

1

我会采用这种方法,因为它降低了“启动”处理,并且仅在鼠标进入图像时才应用光标。

$('img').mouseenter(
    function(ev){
        if($(this).css('z-index') <= 0) 
        {            
            $(this).css('cursor', 'move');
        }
    });
于 2013-02-20T09:03:03.010 回答
0

您需要解析所有元素并测试是否满足您的要求。然后应用你的规则。

$(document).ready(function(){
    $('img').each(function(){
        if($(this).css('z-index') <= 0) 
        {
            //Change CSS cursor attribute
            $(this).css('cursor','move');
        }
    });
});
于 2013-02-20T08:40:39.543 回答