私の現在のスクリプトは少し壊れています。表のリンクをクリックすると、divオーバーレイが正常に作成されます。次に、divを閉じて別のリンクをクリックすると、divオーバーレイが再び開き、閉じるボタンが機能しなくなります。
問題は、「replaceWith」を使用した後、DOMが空のdivを再度認識しないことだと思います。
どんな助けでもいただければ幸いです。
<table id="tableBin" border="0">
<tr>
<th>name</th>
<th>description</th>
</tr>
<tbody>
<tr>
<td><a href="clip/location/A001C012_111129_R1VL.mov">A001C012_111129_R1VL.mov</a></td>
<td>Adipiscing elit. Fusce bibendum, leo non.</td>
</tr>
<tr>
<td><a href="clip/location/A001C012_111130_R1VL.mov">A001C012_111130_R1VL.mov</a></td>
<td>Consectetur adipiscing elit. Fusce bibendum, leo non.</td>
</tr>
</tbody>
</table>
<div id="overlay">
<div id="blackOut" class="hide">
<div id="box" class="hide">
<div id="controls" class="hide"><a href="#"><img border="0" alt="close" width="25px" hieght="25px" src="images/close.png"></a></div>
</div>
</div>
</div>
<script>
$("#tableBin a").on("click", function(e) {
e.preventDefault();
var url = $(this).attr("href");
var video = jQuery('<embed width="640" height="375" ShowControls=1 src="'+url+'" /></embed>');
$('#blackOut').removeClass("hide").addClass("blackOut");
$('#box').removeClass("hide").addClass("box");
$('#controls').removeClass("hide").addClass("controls");
$('#box').append(video);
});
</script>