Commit b2e9c26b by halweg

no message

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