0

css code:-

.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url('UrlToTheImage') center no-repeat #fff;

jquery code:-

$('a').click(function(){
  $(".se-pre-con").show();
}

In my html I have many links.So whenever someone clicks on the link I want to display a gif image till the clicked link is loaded.There is no problem in displaying the gif without jquery i.e. when i just normally display that gif in my html,it gets displayed.But I want to display it only when a link is clicked.Ant btw I am using these two 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>

my html code:

<a  class="se-pre-con" href="LINKURL" >TEST</a></h4>
Soviut
  • 88,194
  • 49
  • 192
  • 260
user7587888
  • 97
  • 1
  • 10
  • Can you show how did you apply the CSS and the actual jquery click event in your html? – imprezzeb Mar 13 '17 at 04:39
  • I did't add applied css and jquery to my html.I thought jquery will do it since I am applying to all 'a' i.e. links. – user7587888 Mar 13 '17 at 04:47
  • Your jquery above will show all elements with class="se-pre-con" applied when an anchor is clicked. If you want your image to be displayed once anchor is clicked you need to add class="se-pre-con". – imprezzeb Mar 13 '17 at 04:49
  • This will display the link with TEST text if that is the case. – imprezzeb Mar 13 '17 at 05:00

1 Answers1

1

Here are the example.

<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>
imprezzeb
  • 706
  • 1
  • 7
  • 18