Pra*_*pta -2 javascript jquery local-storage
请查看下图.

当我点击隐藏图像时,所有图像都显示为替换为静态图像,稍后当我取消选中它时,它必须立即显示原始图像.
<div id="log_contents">
<span style="color:blue;"><b>Public chat</b> with <b>dragos123</b></span> <br><br>
<div class="chat-line">
<span class="dialogue_time"> 11:00:39 AM </span>
<span style="background-color:FFF;">debasish:</span>
<span style="background-color:FFF;"><img style="cursor:pointer; max-height:80px;" src="http://localhost/myshowcam/files/stickers/msc-1427684408.gif" title=":party1"></span>
</div>
<div class="chat-line">
<span class="dialogue_time"> 11:01:43 AM </span>
<span style="background-color:ffff88;">pkk:</span>
<span style="background-color:ffff88;">hiiiiiiiiiiiiii</span>
</div>
<div class="chat-line">
<span class="dialogue_time"> 11:02:03 AM </span>
<span style="background-color:ffff88;">pkk:</span>
<span style="background-color:ffff88;"><img style="cursor:pointer; max-height:80px;" src="http://localhost/myshowcam/files/stickers/msc-1427684892.gif" title=":1min"></span>
</div><div class="pagination" style=""></div>
</div>
Run Code Online (Sandbox Code Playgroud)
请提供宝贵的反馈意见.
谢谢.
您需要在某处保存有关原始版权的信息,否则将无法恢复此更改.
我会将初始代码更改为类似的内容
$("#log_contents").find('img').each(function() {
$(this).data('img-org', $(this).attr('src'));
$(this).attr('src', 'img/hide-image.gif');
});
Run Code Online (Sandbox Code Playgroud)
要扭转它,你只需要做相反的事情
$("#log_contents").find('img').each(function() {
$(this).attr('src', $(this).data('img-org'));
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1364 次 |
| 最近记录: |