我有一个 if 语句不能正常工作,我相信这是因为使用了“this”,但我不知道如何解决它。这是代码:
$('.enlarge').click(function() {
var id = $(this).find(".enlarged_txt").attr('id');
$('#full_image').animate({
height: "100%"
}, 300, function() {
if ( $(this).hasClass("v") ) {
$('#full_image img').attr('src','http://www.klossal.com/klossviolins/instruments/violins/full/' + id + '.jpg');
fadeIn($('#full_image img'));
$("#close_2").css({
display: "block"
});
$("#close").css({
display: "block"
});
}
});
});
<div class="enlarge v" style="float:right;margin-right:70px;margin-top:5px;">
<img class="enlarged_unselected" style="float:left;margin-top:6px;" src="http://www.klossal.com/klossviolins/elements/fullscreen_unselected.png"/>
<img class="enlarged_selected" style="float:left;display:none;" src="http://www.klossal.com/klossviolins/elements/fullscreen_selected.png"/>
<div id="ChasHunnicutt_1928" style="float:left;padding-left:8px;" class="enlarged_txt">Enlarge Image</div>
</div>