$("span:last-child").hide("fast", function () {
$(this).prev().hide("fast", arguments.callee);
});
我无法理解代码中的这一点:
("span:last-child")
:this?arguments.callee
:是什么这是什么发布于 2009-05-26 19:36:18
$
是主要的jQuery函数。
$("span:last-child")
搜索其父级的最后一个子标记的任何<span>
标记。
发现:
<div><span>some data </span> something else <span>testing</span></div>
它将找到包含testing
但不包括some data
的范围。
然后它隐藏了它找到的那些跨度。要隐藏的第二个参数是动画之后的回调。该回调会转到“前一个”子节点(‘That’文本节点),隐藏它并将“被叫函数”(arguments.callee)作为回调传递。这使得这是一个“递归”函数。
这将隐藏以<span>
作为最后一个子块的所有块的全部内容。
发布于 2009-05-26 19:32:31
("span:last-child")
means "if this span is the last child of its parentarguments.callee
allows a function to call itself发布于 2009-05-26 19:35:18
("span:last-child")
返回作为父元素的最后一个子元素的所有span元素。arguments.callee看起来像是试图将函数本身传递给下一个函数。实质上,它传递一个函数指针。看起来它所做的就是找到span对象,然后递归地隐藏所有以前的兄弟姐妹。
https://stackoverflow.com/questions/912261
复制相似问题