Convert Image to background of Content

I am running into a problem and I trying to solve it in the only way that comes to mind. The problem is I am trying to take content that is attached to a image button, but the content is hidden and show it next to the button with a background image when the user hovers over it. Here is when the problem comes in, I have the background image currently as just an image(img tag), so I can stretch it by adjusting the height/width. I want to be able to lay the content on top of that image: For example:
  • this is first
  • This is second
  • This is third content part
  • this is first
  • This is second
  • This is third content part
so with jquery I use disregard simple syntax errors var mem; var img= $("#backgroundDiv").html(); $(".ContentDiv").hover( function(){ mem=$(this).find(".Content").html(); $("#backgroundDiv").html(img+mem); }function(){ }); The above does the intented, which is add all the content after the div img, which is what I'm stumped at, I want to be able to make the background img tag the actual background for the content. If I try to set the background-image in css to the url for the div. The image doesn't make the background as larger enough. Keep in mind I am under **ie 6** for some cases but only as far as **ie 8** for most cases. So what I have tried was using css to change the z-index for the image and the content as so: but doesn't work: #backgroundimg{ z-index:-100; position:absolute; } .Content{ z-index:100; position:relative; }

以上就是Convert Image to background of Content的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准