【小知識】 jquery設置背景圖片

 jquery設置背景圖片時css

設置爲java

$(this).css("background-image","on.jpg");

這個是不起做用的,要改成:jquery

$(this).css("background-image","url(on.jpg)");

添加上URL,若是須要其餘參數直接加上就行。this

如:
url

$("strong").css("background","url(/static/payplug/img/msg_red.jpg) 
left center no-repeat");

就能夠了code

相關文章
相關標籤/搜索