Commit 8096e805 by dhn

测试

parent b7612df5
......@@ -52,17 +52,6 @@
$('.swatch-attribute-selected-option-size-content').hide();
}
});
window.onload = function(){
if($('.swatch-attribute .swatch-option'))
{
var swatchObj = $('.swatch-attribute');
for(var i=0;i<swatchObj.length;i++)
{
$(swatchObj[i]).find('.swatch-option:first').trigger('click');
}
}
}
});
</script>
......
......@@ -381,7 +381,7 @@ define([
isInProductView = false;
productId = this.element.parents('.product-item-details')
.find('.price-box.price-final_price').attr('data-product-id');
.find('.price-box.price-final_price').attr('data-product-id');
if (!productId) {
// Check individual product.
......@@ -749,22 +749,22 @@ define([
}
});
$(".main-image").attr("src",main_img);
$(".main-image-wrapper > picture > source:first ").attr("srcset",main_img);
$(".main-image-wrapper > picture > source:last ").attr("srcset",main_img);
//移除之前选中图
$(".main-image").attr("src",main_img);
$(".main-image-wrapper > picture > source:first ").attr("srcset",main_img);
$(".main-image-wrapper > picture > source:last ").attr("srcset",main_img);
//移除之前选中图
$(".color_img").remove();
$(".thumbnails > a").removeClass("active");
$(".thumbnails >a:first").before("" +
"<a class=\"item active color_img \" href=\"#\" name=\""+ main_img +"\" title=\"Image\">\n" +
" <picture>\n" +
" <source type=\"image/webp\" srcset=\""+thumb_img+"\">\n" +
" <source type=\"image/jpg\" srcset=\""+thumb_img+"\">\n" +
" <img loading=\"lazy\" alt=\"Image\" src=\""+thumb_img+"\" width=\"50\" height=\"66\"> </picture>\n" +
"\n" +
"\n" +
" </a>");
$(".thumbnails >a:first").before("" +
"<a class=\"item active color_img \" href=\"#\" name=\""+ main_img +"\" title=\"Image\">\n" +
" <picture>\n" +
" <source type=\"image/webp\" srcset=\""+thumb_img+"\">\n" +
" <source type=\"image/jpg\" srcset=\""+thumb_img+"\">\n" +
" <img loading=\"lazy\" alt=\"Image\" src=\""+thumb_img+"\" width=\"50\" height=\"66\"> </picture>\n" +
"\n" +
"\n" +
" </a>");
$(".mobile-pic >a:first").before("" +
"<a class=\"item color_img \" href=\"#\" name=\""+ main_img +"\" title=\"Image\" data-caption=\"bear\" data-id=\"bear\" data-group=\"animal\" >\n" +
" <picture>\n" +
......@@ -888,7 +888,7 @@ define([
*/
_toggleCheckedAttributes: function ($this, $wrapper) {
$wrapper.attr('aria-activedescendant', $this.attr('id'))
.find('.' + this.options.classes.optionClass).attr('aria-checked', false);
.find('.' + this.options.classes.optionClass).attr('aria-checked', false);
$this.attr('aria-checked', true);
},
......@@ -1422,7 +1422,7 @@ define([
_EmulateSelected: function (selectedAttributes) {
$.each(selectedAttributes, $.proxy(function (attributeCode, optionId) {
var elem = this.element.find('.' + this.options.classes.attributeClass +
'[data-attribute-code="' + attributeCode + '"] [data-option-id="' + optionId + '"]'),
'[data-attribute-code="' + attributeCode + '"] [data-option-id="' + optionId + '"]'),
parentInput = elem.parent();
if (elem.hasClass('selected')) {
......@@ -1446,7 +1446,7 @@ define([
_EmulateSelectedByAttributeId: function (selectedAttributes) {
$.each(selectedAttributes, $.proxy(function (attributeId, optionId) {
var elem = this.element.find('.' + this.options.classes.attributeClass +
'[data-attribute-id="' + attributeId + '"] [data-option-id="' + optionId + '"]'),
'[data-attribute-id="' + attributeId + '"] [data-option-id="' + optionId + '"]'),
parentInput = elem.parent();
if (elem.hasClass('selected')) {
......@@ -1493,6 +1493,15 @@ define([
var galleryObject = element.data('gallery');
this.options.mediaGalleryInitial = galleryObject.returnCurrentImages();
if($('.swatch-attribute .swatch-option'))
{
var swatchObj = $('.swatch-attribute');
for(var i=0;i<swatchObj.length;i++)
{
$(swatchObj[i]).find('.swatch-option:first').trigger('click');
}
}
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment