I'm working on a Codeigniter project. I have a jQuery
file that sets background-image
to the body:
$('body').css('background-image','url(<?php echo base_url("assets/images/bg2.png");?>)') ;
I tried this to set the image path, but doesn't work.
What should I do?
您可能希望使它像普通的CSS背景图像声明一样
$('myOjbect').css('background-image', 'url(' + imageUrl + ')');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.