jQuery addClass example
Change class name on click in jQuery
by webgleb
HTML
<script type="text/javascript">
$(document).ready(function(){
$("#fly").click(function(){
$("#target")
.clone()
.css({'position' : 'absolute', 'z-index' : '100'})
.appendTo("#fly")
.animate({opacity: 0.5,
marginLeft: 700, /* Важно помнить, что названия СSS-свойств пишущихся
через дефис заменяются на аналогичные в стиле "camelCase" */
width: 50,
height: 50}, 700, function() {
$(this).remove();
});
});
});
</script>
<div style="background: #ccc; padding:10px 5px; height:111px;">
<button id="fly">Полетели!</button><br>
<img src="https://stepasyuk.org.ua/wp-content/uploads/2011/07/103345.jpg" id="target" style="margin:5px 0;">
</div>