Commit a28bfdbc by dhn

商品详情默认选择第一个属性

parent 045a533e
......@@ -17,3 +17,18 @@ if ($block->hasRequiredOptions()) {
<?= $block->getChildHtml('', true) ?>
</div>
</div>
<script>
require(['jquery'], function ($) {
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>
\ No newline at end of file
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