dounong5373 2017-04-16 20:43
浏览 55

如何使用Codeigniter设置background-image(jquery)

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?

  • 写回答

1条回答 默认 最新

  • dqydp44800 2017-04-16 20:47
    关注

    You probably want this to make it like a normal CSS background-image declaration

    $('myOjbect').css('background-image', 'url(' + imageUrl + ')');

    评论

报告相同问题?