SHARE
TWEET

Untitled

Jejkobb Dec 3rd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function swapImg(event){
  2.     var bildSrc = event.target.src;
  3.     console.log(event.target.src);
  4.     document.getElementById("bild").style.opacity = 1;
  5.     document.getElementById("bild").src = bildSrc;
  6.     var bilden = document.getElementById("bild");
  7.     fadeImg();
  8.     if(Number(document.getElementById("bild").style.opacity) == 0.1){
  9.         clearInterval(fade);
  10.         for(i=0;i<10;i++){
  11.             bilden.style.opacity = Number(bilden.style.opacity) + 0.1;
  12.         }
  13.         console.log(stop);
  14.     }
  15.     console.log(document.getElementById("bild").style.opacity);
  16. }
  17.  
  18. var fade;
  19. function fadeImg(){
  20.     fade = setInterval(merGenomskinlig,100);
  21.  
  22.     console.log(document.getElementById("bild").style.opacity);
  23. }
  24.  
  25. function merGenomskinlig(){
  26.     var bilden = document.getElementById("bild");
  27.    
  28.     bilden.style.opacity = Number(bilden.style.opacity) - 0.1;
  29.  
  30.     if(Number(bilden.style.opacity) < 0.1){
  31.         clearInterval(fade);
  32.        
  33.         for(i=0;i<10;i++){
  34.             bilden.style.opacity = Number(bilden.style.opacity) + 0.1;
  35.         }
  36.         console.log(stop);
  37.     }
  38.     console.log(document.getElementById("bild").style.opacity);
  39.  
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top