的CSS圖片標籤style.height不覆蓋css類的高度?
.myStyle {
height: 10px;
background-image: url(../myImage.png);
}
HTML
<img class=myStyle src=<%scriptlet%> >
現在的問題是在我的JS,我已經寫了這個img標籤一個錯誤處理程序,這將設置高度爲0px。這0px來作爲style.height = 0px但不覆蓋類myStyle的高度。
JS
myImage = $('.myStyle', $el);
myImage.error(function() {
myImage.attr('style.height', '0px');
});
你應該閱讀這個http://jqfundamentals.com/chapter/jquery-basics –
我已經發布了我的第二個問題http://stackoverflow.com/questions/14230762/read-the-background-image-attribute-值得一提的是mystyle-in-error-handler- – Nik
感謝大家的及時迴應。 – Nik