javascript - How to verify background (css) image was loaded? -
i have next css class
.bg { background-image: url('bg.jpg'); display: none; }
that i'm applying on td tag.
my question how can tell javascript/jquery background image finished loading?
thank you.
update: added display property. since main objective toggle view.
the way know of load image using javascript, , set image backgroud.
for example:
var bgimg = new image(); bgimg.onload = function(){ mydiv.style.backgroundimage = 'url(' + bgimg.src + ')'; }; bgimg.src = imagelocation;
javascript jquery css load background-image
No comments:
Post a Comment