Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery:选择所有DIV';s嵌套在特定DIV下_Jquery_Css Selectors_Cursor_Mouseover - Fatal编程技术网

jQuery:选择所有DIV';s嵌套在特定DIV下

jQuery:选择所有DIV';s嵌套在特定DIV下,jquery,css-selectors,cursor,mouseover,Jquery,Css Selectors,Cursor,Mouseover,我的架构与此类似: <div id="container"> <div>stuff here</div> <div>stuff here</div> <div>stuff here</div> <div>stuff here</div> </div> 我敢说,你可以同时瞄准父母和孩子 $('#container, #container div').mouseover(func

我的架构与此类似:

<div id="container">
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
</div>

我敢说,你可以同时瞄准父母和孩子

$('#container, #container div').mouseover(function()
{
    $(this).css({cursor: 'none'});
});
当然,我没有测试过这个,但是我不得不使用类似的方法来更改带有
子对象的
  • 的光标

    您可以使用该函数稍微扩展它。

    尝试以下操作:

    $('#container > div').mouseover(function()
    {
        $(this).css('cursor', 'none');
    });
    
    使用children()选择器

    $('#container').children().mouseover(function()
        {
            $(this).css({cursor: 'none'});
        });
    

    虽然有几个正确的答案,但我认为这更有效

    $('#container').mouseover(function(){
       $(this).children().andSelf().css('cursor', 'none');
    });
    

    这样,您只需在
    #容器上使用一个事件侦听器

    将css游标设置为“无”在Chrome中不起作用,仅供参考。@jAndy您如何在Chrome中解决此问题?为什么不使用纯css呢?我相信您可以通过:hover伪类(IE6除外)实现相同的效果。实际上,我刚刚完成了这个chiborg。除了在Chrome下,它工作得很好:(很抱歉,我没有Chrome的解决方案,只是在基于代码执行一些示例时注意到了效果。
    $('#container').mouseover(function(){
       $(this).children().andSelf().css('cursor', 'none');
    });