通过JQuery添加动画背景后,链接和按钮不接受输入。按钮和链接实际上是不可点击的..这个代码下面是我的页脚的动画背景的jquery部分,关于部分和标题。
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){
var header = $('.header');
var about = $('.about');
var footer = $('#footer');
var backgrounds = new Array(
'linear-gradient(rgba(0, 0, 0, 0.40),rgba(0 ,0 ,0 , 0.40)), url(https://static.pexels.com/photos/380769/pexels-photo-380769.jpeg)'
, 'linear-gradient(rgba(0, 0, 0, 0.40),rgba(0 ,0 ,0 , 0.40)), url(https://static.pexels.com/photos/380769/pexels-photo-380769.jpeg)'
, 'linear-gradient(rgba(0, 0, 0, 0.40),rgba(0 ,0 ,0 , 0.40)), url(https://static.pexels.com/photos/7103/writing-notes-idea-conference.jpg)'
, 'linear-gradient(rgba(0, 0, 0, 0.40),rgba(0 ,0 ,0 , 0.40)), url(https://static.pexels.com/photos/541522/pexels-photo-541522.jpeg)'
);
var current = 0;
function nextBackground() {
current++;
current = current % backgrounds.length;
header.css('background-image', backgrounds[current]);
about.css('background-image', backgrounds[current]);
footer.css('background-image', backgrounds[current]);
}
setInterval(nextBackground, 2500);
about.css('background-image', backgrounds[0]);
footer.css('background-image', backgrounds[0]);
header.css('background-image', backgrounds[0]);
});
</script>
答案 0 :(得分:1)
通过删除z-index: -1
来解决此问题。由于某种原因,它会禁用按钮和链接。