コードの気候問題のために私のコードをきれいにする必要があります。このjqueryも似ています。これをどうすれば解決できますか?ズーム用冗長コードを削除しますか?
var angle = 0;
$('.rotate-receipt').on('click', function() {
var index = $(this).data('button-index');
angle = (angle + 90)%360;
var className = 'rotate' + angle;
$('#receipt-image-'+index).removeClass().addClass(className);
});
$('.zoom-in').on('click', function() {
var index = $(this).data('button-index');
var image = $('#receipt-image-'+index);
image.width(image.width() + 100);
});
$('.zoom-out').on('click', function() {
var index = $(this).data('button-index');
var image = $('#receipt-image-'+index);
image.width(image.width() - 100);
});
});
これはトピックではありません。おそらくhttp://codereview.stackexchange.com/のトピックに関する詳細 - おそらくhttp://stackoverflow.com/questions/10511897/assigning-more-than-one-class-for-one-event – mplungjan
@Jの複製。 Doe、 "CodeReview"の質問へのリンクを残しておいてください。 – RomanPerekhrest
あなたのHTMLのサンプルもとても役に立ちます。 –