相対的に配置されたコンテナ内の絶対位置を使用して、メイン コンテナの上に「オーバーレイ」する div があります。hide
ボタンをクリックすると、クラスを削除して表示されるようにしようとしています。コンソールにエラーが表示されなくても(そして非表示にはなりませんが)、効果がないようにnewThread
見えます。
<div id='newThread' class='hide'>
<form>
<textarea></textarea>
</form>
</div>
#container { position: relative; }
#newThread {
position: absolute;
top: 50px;
background-color: rgba(239, 239, 239, 0.9);
left: 50px; width: 600px;
min-height: 480px; border-radius: 5px;
box-shadow: 5px 2px 5px #888;
}
.hide { display: none; }
$('#sidebar').html('<h1>Welcome to the forum!</h1><div class="container"><button class="btn btn-default" id="newThreadButton">New Topic</button><br /><button class="btn btn-default">Log out</button></div>');
$('#sidebar').fadeIn();
$('#newThreadButton').click(function() {
$('#newThread').removeClass('hide');
});
alert($('#newThread').hasClass('hide'));
出力しますfalse
。