문제

I am just wondering if how can I have a call back function in nextAll function of jquery.

I had tried.

$('.selector').nextAll(function() { 
  console.log("try");
});

But its not working. I read the documentation in jquery website but I notice there are no example of callbacks.

I need the nextAll instead of .each to loop through all the next succeeding element of the selector and get the margin right of each succeeding element then animate them to right. I tried,

$('.selector').nextAll().animate({ right: (margin_right-100)+'px'}, 500);
//I am getting the logic here because it animates all the succeeding 
//element but the problem is that I had to replace the 
//`margin_right` variable because the elements next to the 
//selector differs on margin-right.

Any input guys?

도움이 되었습니까?

해결책

Have you tried both?

$('.selector').nextAll().each(function() { 
  console.log(this);
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top