In code below, I am using toggle
method from jquery ui library to animate a div.
The first parameter is the name of
the effect like fold or drop or bouce.
When I pass an
invalid effect like `xyz` then the code below throws an exception
that gets caught by
the catch block.
However, on subsequent re-runs of
the same code no exception gets thrown
and also no animation happens since `xyz` is not a valid effect.
Question
:
Why the error for invalid effect is only being thrown when this code
runs the first time, but not on any runs after that?
-
var emt = $("#cDiv");
try {
emt.hide();
emt.toggle("xyz", {
easing: "swing"
}, 1000, function() {
animationCompleted = true;
startPolling();
});
} catch (e) {
console.log(e.message);
}