Remove element after fading
Hello,
On a plugin I have the following:
- var defaults = {
- hide: function ($element, $tooltip) {
- $tooltip.fadeOut(4000);
- }
- };
- $(this).each(function (e) {
- $this.mouseleave(function (e) {
- tooltip.timer = setTimeout(function () {
- options.hide($this, $("." + options.class).stop(true, true), function () {
- $("." + options.class).remove(); // THE ELEMENT IS NOT BEING REMOVED
- });
- }, 0);
- }), // Mouse leave
- })
On mouse leave I am trying to remove the element after the animation ends.
The problem is that the element is not being removed. But it works if I use:
- $this.mouseleave(function (e) {
- tooltip.timer = setTimeout(function () {
- options.hide($this, $("." + options.class).stop(true, true));
- $("." + options.class).remove(); // THE ELEMENT IS BEING REMOVED
- }, 0);
- }), // Mouse leave
Then everything works fine ... Why is function() { ... } disable the remove action?
Thank You,
Miguel