2011-04-21 64 views
0

我的JQuery幻燈片在出DIV,這滑入出一個按鈕的點擊避免TAB

的問題# 當我broswer打開它,並開始按TAB ,當選擇達到該div(滑動)的選項時,幻燈片div出來(無需點擊按鈕就可以看到)。

有沒有辦法通過該幻燈片格可避免TAB選擇..

與動畫的div在display: none;顯示點擊這裏http://global.redhatsalesteam.com/slide_test/

+1

我們能看到你的代碼?您也可以嘗試隱藏屏幕外的元素,以避免焦點。 – DarthJDG 2011-04-21 10:34:49

+0

在此處查看http://global.redhatsalesteam.com/slide_test/ – 2011-04-21 10:49:09

回答

0

設置您的鏈接-1 tabindex屬性之前,將其更改爲display: block。這應該把他們帶出Tab鍵順序。如果您希望在打開菜單時將它們設置爲可選項,則可以在完整回撥中將其設置回合理的位置。

這樣的事情應該這樣做:

$('#slidemarginleft .button').click(function() { 
    $marginLefty.animate({ 
    marginLefty: parseInt($marginLefty.css('marginLeft'),10) == 0 ? 
    $marginLefty.outerWidth() : 0 
    }, 
    function(){ 
    var counter = 1; 
    if($marginLeft.is(':visible'){ 
     $marginLefty.find('a').each(function(){ 
      $(this).attr('tabindex', counter); 
      counter++; 
     }); 
    } 
    else{ 
      $marginLefty.find('a').attr('tabindex', '-1'); 
    } 
    }); 
}); 
1

開始 - 這將意味着它裏面可以鏈接「T從‘黏合’獲得焦點 - 然後單擊(功能)剛開始的幻燈片動畫

var $marginLefty = $('#slidemarginleft div.inner'); 
$marginLefty.css({ 
    marginLeft: $marginLefty.outerWidth() + 'px', 
    display: 'none' 
}); 

$('#slidemarginleft .button').click(function() { 
    $marginLefty.css('display', 'block').animate({ 
    marginLeft: parseInt($marginLefty.css('marginLeft'),10) == 0 ? 
    $marginLefty.outerWidth() : 0 
    }); 
});