2

Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to finally apply fade-in and fade-out effects to opening the UI Dialog widgets. Hooray!

$dialog.dialog({
        show: { effect: "fade", options: {}, speed: 150 }
}

This works great - unfortunately, there's the known IE7 & 8 bug where the ClearType gets turned off by the application of an empty filter: style attribute after the fade effect is finished.

I have the code to remove the filter attribute, I just can't find a good way to hook it into the event chain. The dialog's "open" and "focus" events are too soon. I need something like a "dialog opening animation is finished" callback.

How can I hook up a callback to the end of the opening effect for a dialog?

Community
  • 1
  • 1
womp
  • 115,835
  • 26
  • 236
  • 269
  • `effect` itself takes a callback, e.g.: http://jqueryui.com/demos/show/#option-callback Have you tried putting it there? – Craig Stuntz Mar 18 '10 at 19:38
  • I think that's the show() method that takes a callback. If there is a way of specifying it in the options array (as I posted), I would love to be able to do that - but I don't seem to be able to find a good example. – womp Mar 18 '10 at 19:44
  • the `show` object appears to take named properties for the arguments of the `show()` method. Have you tried `show: { effect: "fade", options: {}, speed: 150, callback: function () { ... },` ? – Andy E Mar 18 '10 at 19:58
  • Yeah I tried exactly that already - it didn't seem to work :( – womp Mar 18 '10 at 20:01

1 Answers1

3

Try putting your callback as the complete property of the "show" parameter object:

  .show({
    effect: "fade",
    options: {},
    speed: 150,
    complete: function() {
      /* interesting stuff to do here */
    }
  })

I got that by looking at the jQuery (core) source for jQuery.speed which is, I think, where that object passed to show will get sent.

Pointy
  • 405,095
  • 59
  • 585
  • 614
  • Perfect! I wish they'd update the documentation for this stuff ;) – womp Mar 18 '10 at 20:53
  • I agree. I read all the time about how jQuery's documentation is so great, and while I am happy for what's available I **really** wish they'd make it a Wiki (or at least allow "editors" to register with minimal hassle). – Pointy Mar 18 '10 at 20:56