0
我只是想知道如何在nextAll
函數jQuery中有一個回調函數。nextAll()中的回調函數
我曾試過。
$('.selector').nextAll(function() {
console.log("try");
});
但它不工作。我閱讀jquery
網站的文檔,但我注意到沒有回調的例子。
我需要nextAll
,而不是.each
遍歷所有選擇的下一個成功的元素,讓每個後續元素的邊距權然後將它們動畫向右。我試過,
$('.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.
任何輸入的傢伙?
Yah我確實嘗試了兩種方法,它是目前我的代碼的設置,當我將紅色答案與我迄今嘗試過的方法進行比較時,我注意到我缺少一些值。但無論如何,謝謝。只需要在這裏澄清,我們不能把它作爲'nextAll(function(){})'? – HTTP
nextAll不接受函數作爲參數:http://api.jquery.com/nextAll/ –