HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: /home/salamatk/takarzan.ir/wp-content/themes/xts-luman/js/scripts/singleProductSticky.js
/* global xts_settings */
(function($) {
	XTSThemeModule.singleProductSticky = function() {
		if (XTSThemeModule.isTabletSize || 'undefined' === typeof $.fn.stick_in_parent) {
			return;
		}

		var $wrapper = $('.xts-product-sticky');
		var $summary = $wrapper.find('.xts-single-product-summary');
		var $gallery = $wrapper.find('.woocommerce-product-gallery');
		var offset = 40;

		if ($('.xts-sticky-on').length > 0 || $('.xts-header-clone').length > 0) {
			offset = parseInt(xts_settings.single_product_sticky_offset);
		}

		if (0 === $wrapper.length) {
			return;
		}

		$gallery.imagesLoaded(function() {
			var diff = $summary.outerHeight() - $gallery.outerHeight();

			if (diff < -100) {
				$summary.stick_in_parent({
					offset_top  : offset,
					sticky_class: 'xts-is-stuck'
				});
			} else if (diff > 100) {
				$gallery.stick_in_parent({
					offset_top  : offset,
					sticky_class: 'xts-is-stuck'
				});
			}

			XTSThemeModule.$window.on('resize', XTSThemeModule.debounce(function() {
				if (XTSThemeModule.isTablet()) {
					$summary.trigger('sticky_kit:detach');
					$gallery.trigger('sticky_kit:detach');
				} else if ($summary.outerHeight() < $gallery.outerHeight()) {
					$summary.stick_in_parent({
						offset_top  : offset,
						sticky_class: 'xts-is-stuck'
					});
				} else {
					$gallery.stick_in_parent({
						offset_top  : offset,
						sticky_class: 'xts-is-stuck'
					});
				}
			}, 300));
		});
	};

	$(document).ready(function() {
		XTSThemeModule.singleProductSticky();
	});
})(jQuery);