CSS 代码:-
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url('UrlToTheImage') center no-repeat #fff;
jquery代码:-
$('a').click(function(){
$(".se-pre-con").show();
}
在我的 html 中,我有很多链接。所以每当有人点击链接时,我想显示一个 gif 图像,直到加载点击的链接。没有 jquery 显示 gif 没有问题,即当我正常显示该 gif 时在我的 html 中,它被显示。但我只想在单击链接时显示它。Ant 顺便说一句,我正在使用这两个 cdn:-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>
我的 html 代码:
<a class="se-pre-con" href="LINKURL" >TEST</a></h4>
最佳答案
这是例子。
<html>
<body>
<a href="">Show image</a>
<img src="..." class="se-pre-con" style="display:none" />
<script>
$('a').click(function(){
$(".se-pre-con").show();
}
</script>
</body>
</html>
关于jquery - 用户单击链接时无法加载 gif,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42756702/