使用する代わりに配列を使用したい
if(imageExtension == 'jpg' || imageExtension == 'png' || imageExtension == 'gif' ). C
誰か手がかりを教えてください:D
setupChangeImage : function() {
$('.carousel li a').each(function(){
$(this).click(function(e){
e.preventDefault();
var src = $(this).attr('href');
var dataSource = $(this).data('src');
var imageExtension = dataSource.substr(dataSource.length-3, 3);
if (src != $('.gallery img.gallery-main-image,.main-image .main-image-first').attr('src').replace(/\?(.*)/,'')){
$('.gallery img.gallery-main-image,.main-image .main-image-first,.main-image-last').stop().animate({
opacity: '0'
}, function(){
$('.loading').show();
$(this).attr('src', src);
$('.main-image-second').remove();
if(imageExtension == 'jpg' || imageExtension == 'png' || imageExtension == 'gif' ){
var imageLast = '<div class="main-image-second"><img class="main-image-last" src="'+ dataSource +'" alt="" /></div>';
$('.main-image').append(imageLast);
}
else {
var iframe = '<div class="main-image-second"><iframe class="main-image-last" width="657" height="432" src="'+ dataSource +'" style="border:none;margin-top:14px;" scrolling="no" marginwidth="0"></iframe></div>';
$('.main-image').append(iframe);
}
}).load(function(){
$('.loading').hide();
$(this).stop().animate({
opacity: '1'
});
});
}
});
});
}