开发者

jquery <span> inside next()

im trying to get this so that it rotates through LI's, and will fadein the SPAN within that LI after and before the next slide.

heres my code:

        var current = ($('.slider ul li.current'));
    var currentspan = ($('.slider ul li.current span'));
    var next = (current.next().length) ? current.next() : $('.slider ul li:first');
    var nextspan = (current.next('span').length) 开发者_如何学编程? current.next('span') : $('.slider ul li:first span');

The problem is my nextspan variable has to be wrong. All i want to do is grab the SPAN inside the NEXT LI. as you can see the next variable gets set fine - so how do i get the span inside that next variable?


next() only gets the next sibling. So as the span is a child of the next li you'll have to do something like this:

current.next().find('span')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜