开发者

get safari to not show broken image symbol

开发者 https://www.devze.com 2023-01-14 01:05 出处:网络
is there a way to get safari not to show the \"broken image\" symbol, when an image was not found? firefox does this by default.

is there a way to get safari not to show the "broken image" symbol, when an image was not found? firefox does this by default.

i'd preferrably do this with css, but i think javascript will be the way to go... i am using jquery already, eg something like开发者_JAVA百科 this would be great:

$(document).ready(function(){
    $('img').broken().hide();
});


From the jQuery documentation:

$("img").error(function(){
  $(this).hide();
});


There is and event handler called onerror which you can add to the images:

<img src="image.png" onerror="this.style.visibility = 'hidden'" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号