开发者

DIV with background image?

I have 2 DIVs and I want them replaced like Horizontal scroll Any div have a different image How can i do it

I want to display 3 products move from right to left. I want to put a background of a 开发者_JAVA百科picture, excuse the language I'm new on the road, Thanks in advance


It's a little hard to tell what you want, but near as I can tell, you want to change the background image of a DIV.

This is relatively easy to do with jQuery:

$('#the_div').css('backgroundImage','url("new_image.png")');

Take a look at the .css() function.


If you want to dynamicly change the background of the div, then I suggest you go with George Edison's solution. You will have to use Javascript at some point and jQuery is just a sweet library for Javascript.

If, however, you want the images to be static and you want them all in one div, you can use CSS3 Multiple Backgrounds to achieve this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜