jQuery while ループが設定の循環を終了した後に関数を実行しようとしています。ループは一番下にあります
これが私の現在のスクリプトです:
$(document).ready(function() {
$("#radial_container").radmenu({
listClass: 'list', // the list class to look within for items
itemClass: 'item', // the items - NOTE: the HTML inside the item is copied into the menu item
radius: 150, // radius in pixels
animSpeed:400, // animation speed in millis
centerX: 160, // the center x axis offset
centerY: 150, // the center y axis offset
selectEvent: "click", // the select event (click)
activeItemClass: "active",
angleOffset: 185, // in degrees
onSelect: function ($selected) {
$(".radial_div_item").animate({
//opacity: 0.5
}, 0);
$selected.animate({
//opacity: 1
}, 0);
var inner = $selected.html();
var i = 0;
if ($selected.index() > 3) {
while (i < $selected.index()) {
$("#radial_container").radmenu("next");
//Do something once loop finishes
}
} else {
while ($selected.index() > i) {
$("#radial_container").radmenu("prev");
//Do something once loop finishes
}
}
}
});
});
友人は私がこのようなことをすることを提案しましたが、これまでのところうまくいきませんでした:
var looping = function(callback){
*while loop*
callback();
}
私はすでにこの投稿を読みましたが、そこに解決策を見つけることができませんでした linke is here .
マークアップは不要と思われるため含めていませんが、必要な場合は投稿できます。
皆さんありがとう。