Created
June 13, 2011 08:48
-
-
Save calpo/1022484 to your computer and use it in GitHub Desktop.
jquery plugin for jquery-ui Tabs avoid #Bug http://bugs.jqueryui.com/ticket/5510
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($){ | |
$.fn.extend({ | |
/** | |
* jquery-ui Tabs 動作調整用 | |
* タブ切り替えが連続して発生した場合の問題(※)を回避するため、 | |
* 最初のタブ切り替えが終わってから次のタブ切り替えをするように(切り替えイベントを順に実行するように)します | |
* ただし実行キューには最新の1つのイベントのみが入ります | |
* ※fx.opacityオプションにtoggleを指定していて、すばやくタブ1→タブ2→タブ3などと切り替えた際にタブ2が消>えずに残る | |
* | |
* ex) | |
* $('.selector').tabs({fx:{opacity:'toggle'},event:'mouseover'}).stagger_ui_tabs_event(); | |
*/ | |
stagger_ui_tabs_event: function(){ | |
this.bind('tabsselect', function(e,ui){ | |
if( typeof(this.is_processing) == 'boolean' && this.is_processing ){ | |
this.tab_select_queue_index = ui.index; | |
return false; | |
} | |
this.is_processing = true; | |
return true; | |
}); | |
this.bind('tabsshow', function(e,ui){ | |
this.is_processing = false; | |
if( typeof(this.tab_select_queue_index) == 'number' ){ | |
var show_tab_index = this.tab_select_queue_index; | |
this.tab_select_queue_index = null; | |
var $this = $(this); | |
setTimeout(function(){$this.tabs('select', show_tab_index);}, 10); | |
} | |
return true; | |
}); | |
return this; | |
} | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment