我正在看一个教程中的一些代码,用于创建轮播菜单,并注意到没有父级的父级子选择器.从来没有见过这个,并且困惑着它正在做什么.
请参阅以下代码:
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/