私は次のhtmlを持っています:
<div class="contentBlock">
<div><img src="images/help.png" alt="help button" class="helpButton"></div>
<div class="helpBlock">
<p>...some hidden text...</p>
</div> <!-- end .helpBlock -->
<h2>A Header</h2>
<p>...some visible text...</p>
</div> <!-- end .contentBlock -->
私は次のcssを持っています:
div.contentBlock {
position: relative; /* required for z-index */
z-index: 1; /* interacts with div.helpBlock */
}
div.helpBlock {
display: none;
position: relative; /* required for z-index */
z-index: 10; /* interacts with div.contentBlock */
}
私は次のjQueryを持っています:
$(document).ready(function() {
// Show helpBlock on page
$('img.helpButton').click(function(){
/*$(this).closest('.helpBlock').show();*/ // does not work
/*$(this).closest('.helpBlock').css('display');*/ // does not work
var $contentWrapper = $(this).closest('.helpBlock');
var $siblings = $contentWrapper.siblings('.helpBlock');
$siblings.find('.helpBlock').show(); // does not work
});
// end Show helpBlock
}) // end jQuery Functions
ヘルプ ボタンをクリックしたときに .helpBlock を表示しようとしていますが、jquery がどれも機能していません。
誰でも手伝ってもらえますか?
ありがとう。