How do I fade background images using jQuery?

久未见 提交于 2019-12-24 07:51:50

问题


I want to have the background image change form one to another and fade in the process. Consider this for a mouseover/mouseout situation.

How do I fade background images using jQuery?

Is there a jQuery plugin that I need?


回答1:


There might be something available, but it should be easy to put together from the following parts:

  • Use the hover pseudo event to check when the mouse enters and leaves an element.
  • Use fadeIn and fadeOut to change the opacity of an element.
  • Create a div with position:absolute and put two images inside it with position:relative. This will make the images stack on top of each other


来源:https://stackoverflow.com/questions/1966912/how-do-i-fade-background-images-using-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!