내가해야 할 일은 제품 축소판을 클릭하면 주 이미지가 업데이트되지만 알아낼 수없는 경우입니다. 이것에 관한 이상한 부분은 페이지가로드 된 후 브라우저 페이지의 크기를 조정하면 스크립트가 다시 초기화되어 축소판 그림을 클릭하면 주 이미지가 업데이트되는 것입니다.carousFredSel 업데이트 이미지 컨테이너
http://www.venaproducts.com/dev/product/fosmon-hybo-duoc-case-for-amazon-fire-phone/이 도와주세요 여기
데모 링크. 나는 여기 문서를 빗어 봤지만 나는 뭔가를 놓쳤을 것입니다. http://docs.dev7studios.com/jquery-plugins/caroufredsel-advanced
<script type="text/javascript">
var allVariants = "";
jQuery(document).ready(function($) {
$('body').append('<div id="prod_var_images" />');
if (typeof product_variations === 'undefined') {
allVariants = $('form.variations_form').data('product_variations');
} else {
allVariants = product_variations;
}
$('input[name="variation_id"]').change(function() {
var variantID = $(this).val();
var variantData = "";
for (var p = 0; p < allVariants.length; p++) {
if (allVariants[p].variation_id == variantID) {
variantData = allVariants[p];
}
}
//update SKU
if(variantData) {
if(variantData.sku) {
$('span.prod-sku').text('SKU: ' + variantData.sku);
$('*[class*="variation-VN"]:not([class*="variation-' + variantData.sku + '"])').hide();
$('*[class*="variation-' + variantData.sku + '"]').show();
}
}
if(variantData.sku) {
//pull all variation images out and append to #prod_var_images div
$('#product-images img[alt*="variation-VN"]').closest('a').appendTo('#prod_var_images');
//only show main sku variation images below main images
$('#prod_var_images img[alt*="variation-' + variantData.sku + '"]').closest('a').appendTo($('#product-images'));
//reinitialize the slide for new the content
$('#product-images').carouFredSel({
reInit:true,
height: 'auto',
width: 276,
items: 3,
scroll: {
easing: "elastic",
duration: 1000
},
circular: false,
auto: false,
swipe: {
onMouse: true,
onTouch: true
},
prev: ".product-prev",
next: ".product-next",
});
//rebuild thumbnail links to go to correct images - NOT WORKING
$('#product-images a').each(function(i) {
$(this).bind('click', function() {
$('#product-images a').addClass('active');
});
});
}
});
});
</script>