Changing background image when hovering on a list item

前端 未结 4 1973
耶瑟儿~
耶瑟儿~ 2020-12-19 04:37

As you can see in the screenshot, I\'ve got an unordered list. Now the div of this list has a background image. What I want to do is to change background\'s ima

4条回答
  •  借酒劲吻你
    2020-12-19 04:56

    you can use js to deal with it.

    var imgsArr = [url1,url2,......] ;//array of backgroud img's url
    var container = $(".menu li"); //suppose you have linked in jquery
    function setBackgroudHover(imgArr,container)
    {
    	container.hover(function() {
    			//mousein
    			for(var i=0;i

提交回复
热议问题