setInterval()

by atheer Salim

HTML

<div>
hej
</div>

CSS

.utseende{
  background:lightblue;
  width:200px;
  height:300px;
}


div{
  background:grey;
  width:400px;
  height:200px;
  border-radius:0px;
 transition: width 1s, height 1s; 
}

JavaScript

$(document).ready(function(){

var hej= setInterval(function(){
$("div").toggleClass("utseende"); 
}, 1000);

$("div").click(function() {
clearInterval(hej);
})


});