const observer = new IntersectionObserver((entries) => {
entries.forEach(e => {
if (e.isIntersecting) {
e.target.src = e.target.dataset.src;
observer.unobserve(e.target);
}
});
}, { rootMargin: '200px' });
document.querySelectorAll('iframe[data-src]').forEach(el => observer.observe(el));content-visibility: auto с contain-intrinsic-size — браузер будет пропускать layout/paint за пределами экрана. <?php foreach ( $product_attributes as $product_attribute_key => $product_attribute ) : ?>
<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--<?php echo esc_attr( $product_attribute_key ); ?>">
<th class="woocommerce-product-attributes-item__label"><?php echo wp_kses_post( $product_attribute['label'] ); ?></th>
<td class="woocommerce-product-attributes-item__value"><?php echo wp_kses_post( $product_attribute['value'] ); ?></td>
</tr>
<?php endforeach; ?> // Добавим текстовое поле "Имя"
add_filter( 'woocommerce_checkout_fields' , 'add_payments_name' );
function add_payments_name( $fields ) {
$fields['shipping']['shipping_apartment'] = array(
'type' => 'text',
'label' => __('Кто заплатил', 'woocommerce'),
'placeholder' => _x('Введите имя...', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('from-input'),
'clear' => true
);
return $fields;
}