Reputation: 541
I've written an animate function that I can use passing different properties which I'd like to animate but for some reason IE11 doesn't like it.
Researching the error I thought it might be a trailing comma or reserved keyword that I shouldn't be using but I've tried everything.
Can anyone point me in the right direction please?
function animate(id, propertyName, propertyValue, propertyEasing, propertyDuration) {
$('#' + id).stop().animate({
[propertyName]: propertyValue // THIS IS THE LINE CAUSING THE PROBLEM
}, {
duration: propertyDuration,
easing: propertyEasing,
queue: false
});
}
Here's a Fiddle.
Upvotes: 0
Views: 67
Reputation: 931
Please use the following code
var animation = {};
function animate(id, propertyName, propertyValue, propertyEasing, propertyDuration) {
animation[propertyName] = propertyValue;
$('#' + id).stop().animate(
animation, {
duration: propertyDuration,
easing: propertyEasing,
queue: false
});
}
animate ('test', 'height', '600px', 'easeOutQuint', 6000);
Upvotes: 1