-1

I have a data widget and each time the widget is clicked the page is refreshed. When I'm offline I want to display a nowifi image above the data image for 3 seconds.

I have onerror="wifioff()" function in the data image.

How can I show the nowifi image for a few seconds above the data image.

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
  • Questions seeking help must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. – serdar.sanri Aug 01 '17 at 20:55

1 Answers1

0

In your html put this somewhere

In your javascript:

var secondstildone=3; var intervalVariable;

function wifioff(){

      $("#errorImg).attr("src", "Images/errorImg.png");

      var f = DoTimerStuff;
      intervalVariable = setInterval(f, 1000);
    }

        DoTimerStuff() { 
            secondstildone--;
            if(secondstildone <= 0){
               $("#errorImg).attr("src", "");
               clearInterval(intervalVariable);
             }

        }
nicko
  • 460
  • 3
  • 11