the code worked until line 48, after which it no longer worked. I would like to implement the switch on the "move" button on line 50-62, but this gave me the error Error: Uncaught SyntaxError: Unexpected token }
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="1.js"></script>
<title>Prova Jquery</title>
<!-- Fogli di stile -->
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<body>
<div class="container" id="effetti">
<p>Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur</p>
<a href="https://www.google.it/">vai su google</a>
<button type="button "id="nascondi-immagine">Nascondi </button>
<button type="button" id="mostra-immagine">Mostra </button>
<button type="button" id="sposta-immagine">Sposta </button>
<p><img src="blu.jpg" \></p>
</div>
</body>
</html>
file 1.js :
$(function(){
$("#effetti")
.fadeIn(12000);//effetto opacita in 12 secondi
$("#effetti")//sul DIV che si chiama effetti
.on({ //permette di fare qualcosa intercettando un evento (click, mouseover, onclick..)
mouseover: function(){//creo una function anonima
console.log("MOUSE OVER");
}, //sotto scrivo un'altra funzione sempre ANONIMA
click: function(){//tutte le volte che scrivo "nome-evento" e due punti dentro gli passo un oggetto
console.log("CLICK");
}
});
$("#nascondi-immagine")
.on({
click:function(){//quando faccio click
$("img").hide();//devi nascondere l'immagine
}
});
$("#mostra-immagine")
.on({
click:function(){
$("img").fadeIn(3000);//immagine deve comparire in 3'
}
});
//prEventDefault serve a prevenire il comportamento di default del dom html
$("#effetti a")//sul DIV che si chiama effetti SELEZIONO gli elementi a
.on({ //permette di fare qualcosa intercettando un evento (click, mouseover, onclick..)
click:function(e){//passo un parametro "e" che corrisponde all'elemento "a" in pratica
e.preventDefault();
}
});
$(window)
.on("load", function(){
$("#effetti")
.css({
"margin-top":10%
});
});
$(window)//l'oggetto window di js
.on("load",function(){//scrivo load ed apro un function anonima
$("#sposta-immagine")
.on({
click:function(){//al compimento di questa azione ovvero click su bottone
$("effetti")//sul DIV che si chiama effetti
.css({
"background":"red",
"margin-left":10%
});
}
});
});
});
when I update the 1.js file even if I delete the function from line 50-62 it continues to give me the usual error. in the sense the google chrome console always gives me the old error on that code even if that code has been deleted