Haz*_*zel 2 jquery dynamic-attributes loading-image
我知道可以使用动态加载图像
$("#id").attr("src","path of the image"),
Run Code Online (Sandbox Code Playgroud)
但要在特定事件上载入特定图像,
$("id").attr("src","")
Run Code Online (Sandbox Code Playgroud)
不起作用.
使用jquery卸载映像运行时的正确方法是什么?
我无法更改图像的显示或可见性属性,我需要加载它卸载它.
有很多方法可以做到这一点.你可以使用适合你的那个
$('#id').removeAttr('src');? // Remove the src$('#id').remove(); //This will remove the element from DOM so be careful$('#id').attr('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='); // This will change the src to a 1x1 pixel
$('#id').removeAttr('src').replaceWith($image.clone()); //That worked for few people
| 归档时间: |
|
| 查看次数: |
16667 次 |
| 最近记录: |