没有父母的jquery子选择器

我正在看一个教程中的一些代码,用于创建轮播菜单,并注意到没有父级的父级子选择器.从来没有见过这个,并且困惑着它正在做什么.

请参阅以下代码

var $wrapper = $('> div',this).css('overflow','hidden'),$slider = $wrapper.find('> ul'),$items = $slider.find('> li'),$single = $items.filter(':first'),singleWidth = $single.outerWidth(),visible = Math.ceil($wrapper.innerWidth() / singleWidth),// note: doesn't include padding or border
        currentPage = 1,pages = Math.ceil($items.length / visible);

这里的教程:http://jqueryfordesigners.com/jquery-infinite-carousel/

解决方法

一个父类(或在这种情况下是一个范围),请注意选择器中的这个关键字,这是相对于插件被应用的元素.

jQuery的选择器允许你设置一个范围,它可以是任何jQuery元素对象.

考虑

$(".somediv").myplugin();

并在插件里面

$("> div",this) 
is actually translated to 
$("> div",$(".somediv"))

看看我的一个问题,答案解释了很多关于jQuery的选择器.
What is the fastest method for selecting descendant elements in jQuery?

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...