开发者

jQuery Tools tabs and custom event data?

I have jQueryTools tab panel on my page. It consists of 3 tabs. At the same time a have a set of corresponding - so to say "remote" - links somewhere else on the same page. The intention is to have the tabs switch to a corresponding tab upon clicking the "remote" link. This I'm achieving using the api.click() method.

However the behavior has to be differentiated in that clicking on the remote link has to additionally scroll to the tab panel using the scrollTo plugin.

If I globally change the api behavior to this:

tabs_api.onClick(function(e, index){
    $('body').scrollTo( $("ul.开发者_如何学Pythontabs") , 400);
});

The tabs will unnecessarily jump and scroll also when they are already in the comfortable viewing area. If I do the scrollTo outside of the api though, the scroll will never behave properly, because the command occurs in that eye-blink when the tab panes are all hidden and have zero height, and so the tab panel leans against the bottom of the page.

So my idea is to leave the scrollTo stuff in the api, but attach some kind of a flag to the event to tell if the scroll should be performed or not. The question is: ss it possible to hook my custom flag to the event generated by the tab plugin?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜