jQuery addClass example

Change class name on click in jQuery

by DefuZe

HTML

<div class="santa"><img src="https://mnogoblog.ru/wp-content/uploads/2015/12/santasled.gif" alt="" /></div>

CSS

.santa {
position: fixed;
bottom: 10px;
right: -500px;
}

JavaScript

$(document).ready(function() {
var windowWidth = $(document).width();
var santa = $('.santa');
santa_right_pos = windowWidth + santa.width();
santa.right = santa_right_pos;
function movesanta(){
santa.animate({right : windowWidth +  santa.width()},15000, function(){
santa.css("right","-500px");
setTimeout(function(){
movesanta();
},60000);
});
}
movesanta();
});