Commit b2e9c26b by halweg

no message

parent 978cd70b
...@@ -301,19 +301,27 @@ ...@@ -301,19 +301,27 @@
if ($(this).hasClass('-active')) { if ($(this).hasClass('-active')) {
return; return;
} }
var currentType = $('.chart-size-switch-item.-active').data('size-type');
$(this).addClass('-active').siblings().removeClass('-active'); $(this).addClass('-active').siblings().removeClass('-active');
var type = $(this).data('size-type'); var type = $(this).data('size-type');
var percent = 2.54; var percent = 2.54;
if (currentType == type) {
return;
}
$.each($(".size-item"), function (x) { $.each($(".size-item"), function (x) {
var current = $(this).data('size-item-cm'); var current = $(this).data('size-item-inc');
if (type == 'inc') { if (currentType == 'inc' && type == 'cm') {
var data = (current / percent - 0).toFixed(2); var data = (current * percent - 0).toFixed(2);
} else { } else {
var data = $(this).data('size-item-cm'); var data = $(this).data('size-item-inc');
} }
$(this).html(data); $(this).html(data);
}); });
}); });
$(document).ready(function () {
$('.chart-size-switch-item-cm').click();
});
}); });
</script> </script>
<li class="lis" style="display: none;"> <li class="lis" style="display: none;">
...@@ -330,8 +338,8 @@ ...@@ -330,8 +338,8 @@
<div id="chart-details"> <div id="chart-details">
<div class="chart-size-switch "> <div class="chart-size-switch ">
<input type="hidden" value=""> <input type="hidden" value="">
<span class="chart-size-switch-item chart-size-switch-item-cm" data-size-type="cm"><?= __('cm'); ?></span>
<span data-size-type="inc" class="chart-size-switch-item -active"><?= __('Inch'); ?></span> <span data-size-type="inc" class="chart-size-switch-item -active"><?= __('Inch'); ?></span>
<span class="chart-size-switch-item " data-size-type="cm"><?= __('cm'); ?></span>
</div> </div>
<!--全局table已被污染,请使用div模拟表格--> <!--全局table已被污染,请使用div模拟表格-->
<div class="table" id="fme_sizechart_table" style="display: table;"> <div class="table" id="fme_sizechart_table" style="display: table;">
...@@ -354,7 +362,7 @@ ...@@ -354,7 +362,7 @@
?> ?>
<div style="display: table-row" class="tr"> <div style="display: table-row" class="tr">
<?php foreach ($body as $key2 => $item): ?> <?php foreach ($body as $key2 => $item): ?>
<div style="display: table-cell" class="td <?php if($key2 != 0) { echo 'size-item'; } ?> " data-size-item-cm="<?= $item ?>"><?= $item ?> </div> <div style="display: table-cell" class="td <?php if($key2 != 0) { echo 'size-item'; } ?> " data-size-item-inc="<?= $item ?>"><?= $item ?> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
......
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