Install data-toggle function bugfix.

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12271 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ChanMyeong 2012-11-21 04:54:54 +00:00
parent 40dd5276c5
commit c71e918121

View file

@ -2,12 +2,17 @@ jQuery(function($){
// TARGET toggle
$(document.body).on('click', '.x [data-toggle]', function(){
var $this = $(this);
if($this.is('a') && $this.attr('href') != $this.attr('data-toggle')){
var target = $this.attr('href');
$this.attr('data-toggle', target);
}
var $target = $($this.attr('data-toggle'));
var focusable = 'a,input,button,textarea,select';
$target.toggle();
if($target.is(':visible') && !$target.find('a,input,button,textarea,select').length){
$target.attr('tabindex','0').focus();
} else if($target.is(':visible') && $target.find('a,input,button,textarea,select').length) {
$target.find('a,input,button,textarea,select').eq(0).focus();
if($target.is(':visible') && !$target.find(focusable).length){
$target.not(':disabled').attr('tabindex','0').css('outline','0').focus();
} else if($target.is(':visible') && $target.find(focusable).length) {
$target.not(':disabled').find(focusable).eq(0).focus();
} else {
$this.focus();
}