What I want to do is:
I have a function that animates a div
's margin-left percentage, with an associated distance counter (for another function):
function animateValue(amount, counter) {
myDivToAnimate.animate({
marginLeft: amount + '%'
}, 1200, function () {
slideCounterValue = counter;
});
}
And I'm calling it as follows, decimal places are required for this:
animateValue(-100.5, -1)
What I want to do is make an array or an object (I'm not sure which), that has the arguments from above. So for eg:
var myArray = [{-100.5: -1},{-200.8: -2},{-312.5: -3}...]
and then pass these to my animateValue() arguments.
I'm not sure how to either:
- Create the array with integers, which are negative and have decimals
- Pass these pairs from the array to my animateValue() arguments.
Finally, once I have these sorted I need to randomize the array key-value pairs that are pulled, so that each time it animates to a different margin-left and associated counter value.
It's probably a simple answer but I can't seem to get my head around it.
Aucun commentaire:
Enregistrer un commentaire