I'm trying to perform a function after a jQuery while loop has finished cycling through its settings. The loops are near the bottom
Here is my current script:
$(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
}
}
}
});
});
A friend has suggested I do something like this but it has not worked for me so far:
var looping = function(callback){
*while loop*
callback();
}
I have already read through this post but was unable to find a solution in there linke is here.
I haven't included my markup because it seemed unnecessary but if it is needed I can post it up.
Thanks all.