I have this code
out.print("<img class="blurry-load" style="margin:0px;border:0px;padding:0px;left:0px;top:0px;" id="" + getId() + "" " +
" onmousedown="registraPosicion(event);" ondragstart="registraPosicion(event);" ondrag="reposiciona(event);" ondragend='setTimeout("registraPosFinal();",500);" 'onload='loaded((this.id).removeClass("blurry-load"));'" +
"src="" + request.getContextPath() + "/imagestore/" + newFileName +
"?" + getNode() + "=" + selectId + "&" + "image.index" + "=" + fileIndex + "" width="" + widthSize +
"" height="" + heightSize + "" alt="Tamaño " + widthSize + " x " + heightSize + "">");
i need that the img css class that only purpose is to blur the image while loading (blurry-load), get removed from that image after being loaded to make this work i need to figure out:
1.- How i can remove the (class="blurry-load") effect from the img tag
2.- i tried with (‘onload=’loaded((this.id).removeClass("blurry-load"));’"), in the above code but the image stills blured after being loaded.
3.- About the awfull format of the img tag, its bc this tag is sent from a java method in jsp.
What i am doing wrong? thanks in advice
Sorry for my poor choice of words.
Edit: Both solutions worked so fine, i selected the one who actually needs less code. Thank you so much!
2
Answers
Not sure what
loaded
does but if you tryonload="this.classList.remove('blurry-load')"
, it should remove the class.Maybe you should check Browser dev-tools error and set some HTTP header in your server;
Suppose your loaded((this.id).removeClass("blurry-load")); can works well.
While I have used
instead.
I tried to invoke my code in Chrome search page, and I get an error below.
It’s because of Google HTTP header is setted to
unsafe_hashes is not included in this;