Answer the question
In order to leave comments, you need to log in
How to iterate a function?
How can I make it work when clicked again.
var clicks = 0;
$( "#telegramm" ).click(function() {
if (clicks == 0){$( ".write-btn-telegramm" ).css("right", "80px");}
else{$( ".write-btn-telegramm" ).css("right", "19px");}
++clicks;
});
Answer the question
In order to leave comments, you need to log in
var clicks = 0;
$( "#telegramm" ).click(function() {
if (clicks%2 == 0){$( ".write-btn-telegramm" ).css("right", "80px");}
else{$( ".write-btn-telegramm" ).css("right", "19px");}
++clicks;
});
Move styles to css.
.write-btn-telegramm {
right: 19px;
}
.write-btn-telegramm.active {
right: 80px;
}
$( "#telegramm" ).click(function() {
$( ".write-btn-telegramm" ).toggleClass("active");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question