我有一个小问题。我可以通过单击 html 链接在整个页面上进行时尚。但是我想更改与数组中的链接相对应的图像。
在我的代码下面,在页面html之间淡入和淡出:
脚本
$(window).load(function(){
$("#overlay").fadeOut(1500);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("#overlay").fadeIn(1000, function() {
window.location = linkLocation;
return false;
});
});
});
CSS
#overlay {
position: fixed;
top: 0; left: 0;
background: #fcc916 url(img/logo/blablabla.png) no-repeat center center;
/*background: #ffffff;*/
width: 100%;
height: 100%;
z-index: 314159;
}
.html
<div id="overlay"></div>
我知道我必须用图像做一个数组并在 getElementByld 中检索它们,但我不知道如何......
感谢您的宝贵帮助,对不起我的英语
试试...
$("#overlay")
.attr("style", "background: #fcc916 url(img/logo/" + fromarray[i] + ".png) no-repeat center center");
。这将通过jQuery更改背景图像。 .png部分也可能来自数组。