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/hotSpotsElement.js
/* global xts_settings */
(function($) {
	XTSThemeModule.xtsElementorAddAction('frontend/element_ready/xts_hotspots.default', function() {
		XTSThemeModule.hotSpotsElement();
	});

	XTSThemeModule.hotSpotsElement = function() {
		$('.xts-spot').each(function() {
			var $this = $(this);
			var $btn = $this.find('.xts-spot-icon');

			if ((!$this.hasClass('xts-event-click') && XTSThemeModule.isDesktopSize ) || $this.hasClass('xts-inited')) {
				return;
			}

			$this.addClass('xts-inited');

			$btn.on('click', function() {
				var $content = $(this).parent().find('.xts-spot-content');

				if ($content.hasClass('xts-opened')) {
					$content.removeClass('xts-opened');
				} else {
					$content.addClass('xts-opened');
					$content.parent().siblings().find('.xts-spot-content').removeClass('xts-opened');
				}

				return false;
			});

			XTSThemeModule.$document.on('click', function(e) {
				var target = e.target;

				if ($this.find('.xts-spot-content').hasClass('xts-opened') && !$(target).is('.xts-spot') && !$(target).parents().is('.xts-spot')) {
					$this.find('.xts-spot-content').removeClass('xts-opened');
					return false;
				}
			});
		});

		$('.xts-spot-content').each(function() {
			var $this = $(this);
			var offsetLeft = $this.offset().left;
			var offsetRight = XTSThemeModule.windowWidth - (offsetLeft + $this.outerWidth());

			if (XTSThemeModule.isTabletSize) {
				if (offsetLeft <= 0) {
					$this.css('marginLeft', Math.abs(offsetLeft - 15) + 'px');
				}

				if (offsetRight <= 0) {
					$this.css('marginLeft', offsetRight - 15 + 'px');
				}
			}
		});
	};

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