それはPIE.htcと再描画に関係しているようですので、ブラウザを再描画させないのはどうでしょうか。divを邪魔にならない場所に移動してから、もう一度元に戻してください。
<script type="text/javascript">
$(document).ready (function () {
$('#show_div').bind ('click', function () {
// show it by returning it to it's default position
$('#tab_container_3').css ( {position : 'static'} );
});
$('#hide_div').bind ('click', function () {
// hide it again by making it read the z-index
$('#tab_container_3').css ( {position: 'relative'} );
});
});
</script>
このCSSを次のように変更します。
#tab_container_3{
position: relative;
top: -9999px;
}
それは邪魔にならないように移動しているだけです。jQueryでposition
toを変更すると、デフォルトに戻ります。aが付いている要素は、を受け入れないため、変更する必要はありません。static
a
position
static
z-index
更新しました
アクセシビリティ(またはそうでない)情報に従って
コンテンツにアクセスできないようにするための防弾方法はdisplay: block
、visibility: hidden
一緒に使用することですが、上記の問題については、すでに指摘されているように、動作で<li>
はなく親自体を非表示にすることをお勧めし<a>
ます。今回はクラスを追加および削除することでそれを行いました
これは機能しているようです:
$(document).ready (function () {
// to make tab hidden and inaccessible onload
$('#tab_container_3').parent().addClass("element-invisible");
$('#show_div').bind ('click', function () {
$('#tab_container_3').parent().removeClass ("element-invisible");
});
$('#hide_div').bind ('click', function () {
$('#tab_container_3').parent().addClass ("element-invisible");
});
});
このクラスがCSSに追加されました(追加のCSS#tab_container_3
は不要になりました)
.element-invisible {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
visibility: hidden;
display: none;
}
FFでCTRL+Fをテストしましたが、非表示のタブが見つかりません
このメソッドでは最初の3つのポジショニングとクリップのルールは必要ないと思います。最初にそれらを試しましたがa
、IEで効果を完全にトリミングしなかったため、クラスを親liに移動しました。ルールを残して、私が試したことを示します-ルールが何であるか疑問に思っている場合に備えて;)
三度目のラッキー
this time I tried a combination, first loading the parent li
off the page with negative z-index, the setting up a delay so that 0.5 seconds later it hides and corrects the z-index, the theory here was trying to make PIE.htc draw the corners before hididng them, I figured nobody will be searching the content within 0.5secs ;) - it's not totally smooth in IE but I think it's because of the positioning of the effects PIE.htc uses to draw the corners and shadows, but the effect does draw now, I tried slide down to reveal the div as that seems to "hide" the worst of IE's jaggy reveal
$(document).ready (function () {
// to make tab hidden but accessible onload, accessible at first to allow link to draw, then hide it after 0.5 seconds
$('#tab_container_3').parent().css('top','-9999px').delay(500).hide('fast', function() {$(this).css({'top' : '0px'});});
$('#show_div').bind ('click', function () {
$('#tab_container_3').parent().slideDown(200);
});
$('#hide_div').bind ('click', function () {
$('#tab_container_3').parent().hide(100);
});
});