在Zepto.js中有类似nextAll()的东西吗?

0 javascript zepto

我有一个节点列表:

<div id="node-1"></div>
<div id="node-2" class="current"></div>
<div id="node-3"></div>
<div id="node-4"></div>
<div id="node-5"></div>
Run Code Online (Sandbox Code Playgroud)

当使用$(".current")as选择器(node-2)时,如何使用Zepto获取所有节点3-5 ?

mjl*_*ano 6

这应该工作.几乎像http://api.jquery.com/nextAll/http://api.jquery.com/prevAll/

;(function($){
var e = {
    nextAll: function(s) {
        var $els = $(), $el = this.next()
        while( $el.length ) {
            if(typeof s === 'undefined' || $el.is(s)) $els = $els.add($el)
            $el = $el.next()
        }
        return $els
    },
    prevAll: function(s) {
        var $els = $(), $el = this.prev()
        while( $el.length ) {
            if(typeof s === 'undefined' || $el.is(s)) $els = $els.add($el)
            $el = $el.prev()
        }
        return $els
    }
}

$.extend( $.fn, e )
})(Zepto);
Run Code Online (Sandbox Code Playgroud)