私はexampleで開始し、それを作るためにコードを追加しました:アクセや動的なアニメーション情報ボックス
- ダイナミック高さ
- でJSを使用してアクセス私が行っている
オリジナル:バージョンvisable hereの作業
$('#example-links a').hover(function(){
var index = $("#example-links a").index(this);
$('#example-content').animate({"marginTop" : -index*220 + "px"}); // multiply by height+top/bottom padding/margin/border
});
マイ変更されたコードを、それだけで上記に比べて少し長いようだ:
var maxHeight = 0, container_maxHeight = 0;
var example_content = $("#example-content");
var example_div = example_content.children("div");
example_div.each(function() {
if($(this).height() > maxHeight) {
maxHeight = $(this).height();
container_maxHeight = $(this).outerHeight(true);
}
});
example_div.height(maxHeight);
$("#example-content-container").css({
"overflow":"hidden",
"height": container_maxHeight+"px"
});
$('#example-links a').bind('click mouseover', function(e){
var index = $("#example-links a").removeClass("active").index(this);
$(this).addClass("active");
example_content.stop().animate({"marginTop" : -index*container_maxHeight + "px"});
e.preventDefault();
});
私は両方のクリックを結合して、私はそれがマウスオーバーで動作するようにしたいが、私はまた、マウスを持っていない携帯電話でブラウジングするときにそれを動作させたいと思っている。
私は非常にアクセス/ユーザーフレンドリーとしてあなたの「JS-フリー」版を考えていません。リンクをクリックしても効果はありません。非常に混乱します。 @ Shefの答えと私のコメントを見てください。 –