The lifecycle in browse is different than you expect. jQuery slideUp() make effect and than call the notify function as callback after slide effect is finished. However, wicket send all javascripts as AJAX from the server to pro browser, so it change you component (HTML tag) before the slide effected is finished.
The execution is
- prependJavaScript - it starts slideUp
- rendering/replacing the component
- appendJavaScript - slideDown
- call 'notify'
If I understand your example, notify is not a JS function.
So you have to use a JS callback, so write your own JS event in the following order:
- invoke slideUp
- invoke 'notify()' function fron slideUp
- notify() has to call back to the wicket AJAX
- replace the component
There are many ways how to do that. You can try to write your own AjaxEventBehavior that listen a custom event, such as 'afterSliding'
and call from notify $('#myid').trigger('afterSliding'); to invoke that behavior. You behavior has to replace component from onEvent() method that is abstract and you have to implement.