开发者

jQuery UI.Layout: How to delay pane opening

开发者 https://www.devze.com 2023-02-04 16:07 出处:网络
I am using UI.Layout, trying to create a behavior similar to the ExtJs layout: On close / open of the horizontal panes, the resizer should be hidden and re-appear with a slide effect.

I am using UI.Layout, trying to create a behavior similar to the ExtJs layout: On close / open of the horizontal panes, the resizer should be hidden and re-appear with a slide effect.

This was easy on pane closing, since the effect appears after the onclose event, but I'm having serious difficulties on applying the same behavior on pane open.

Since the event for onopen triggers regardless of the effect being applied on the resizer, i find no way of delaying the pane opening until the resizer slide is complete.

Here is the relevant code:

outerLayout = $('#outer-layout').layout({
    west : {
        // ...
        onclose_start : function() {
            hideResizer('west');
        },
        onclose_end : function() {
            styleResizer('west');
            showResizer('west');
            animateResizerOnClose('west');
        },
        onopen_start : animateWestResizerOnOpen
    }
    // ...
});

function animateWestResizerOnOpen() {
    $(this).parent().delay(1400).queue(fu开发者_运维百科nction() {
        $('#outer-layout').layout().open('west');
    }).hide('slide', 300);
}

What's wrong here?


Somewhat of a workaround, but it works well:

Since it seems there is no way of interfering with the fx-queue of the pane-resizer, and setTimeout() would offer no help, having the event triggering regardless, I sidesteped the problem using a steeper curve of the pane opening fx easing. This allows for the pane to open with a relativly slow start, and the resizer back-slide shows.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号