PageSourceSearch

https://hotelillua.com/wp-content/themes/illua/js/popup.js?ver=1.1.3

js hotelillua.com collected 2026-10-07 00:27:17 UTC 4,858 bytes, 196 lines download raw bytes

1/*
2 * File       : js/popup.js
3 * Author     : STUDIO-JT (HEE)
4 * Guideline  : JTstyle.1.0
5 *
6 * Dependency : js/jt.js
7 *
8 * SUMMARY:
9 * 1) INIT
10 * 2) Functions
11 */
12
13
14
15
16jQuery(function($) {
17
18
19
20/* **************************************** *
21 * INIT
22 * **************************************** */
23jt_popup_slider(true);
24// jt_popup_setting();
25jt_popup_close();
26
27
28
29/* **************************************** *
30 * Functions
31 * **************************************** */
32function jt_popup_slider(first){
33
34	$('.jt-popup--slideshow').each(function(){
35
36		var $this = $(this);
37		var $slider = $this.find('.swiper-container');
38		var $slider_item = $this.find('.jt-popup__item');
39		var switch_color = function(index){
40			var $strap_slider = $('.jt-popup--strap');
41			var $current_slide = $strap_slider.find('.swiper-slide').eq(index);
42			var color = $current_slide.attr('data-controlcolor');
43			var $control = $strap_slider.find('.jt-popup__control');
44
45			$strap_slider.find('.jt-popup__close').css('color',color);
46			$control.find('.jt-popup__arrow').css('color',color);
47			$control.find('.swiper_play_state_btn').css('color',color);
48			$control.find('.swiper_play_state_btn svg path').css('fill',color);
49
50			setTimeout(function(){
51				$control.find('.swiper-pagination-bullet').css({'borderColor':color,'backgroundColor':'transparent'});
52				$control.find('.swiper-pagination-bullet-active').css('backgroundColor',color);
53			}, 10)
54		}
55
56		if( !$slider.length ) return;
57
58		if( $this.hasClass('jt-popup--strap')){ // strap
59			if( $slider_item.length < 2) return;
60		} else { // floating
61            if( !first ) return;
62        }
63
64		// swiper option
65		var slider_options = {
66			effect : 'fade',
67			loop: true,
68			slidesPerView: 1,
69			navigation: {
70				nextEl: '.jt-popup--strap .jt-popup__control .jt-popup__arrow--right',
71				prevEl: '.jt-popup--strap .jt-popup__control .jt-popup__arrow--left',
72			},
73			pagination: {
74				el: '.jt-popup--strap .jt-popup__control .swiper-pagination',
75				clickable: true,
76				renderBullet: function (index, className) {
77					return '<span class="' + className + '"><i><em class="sr_only">' + (index + 1) + '</em></i></span>';
78				}
79			},
80			autoplay: {
81				delay: 5000,
82				disableOnInteraction: true
83			},
84			on: {
85				init: function () {
86					switch_color(this.activeIndex);
87
88					if(!first) {
89						// reinit
90						$slider.find('.jt-popup__item').each(function(){
91							var $this = $(this);
92							$this.css( $this.data('bgtype') , $this.data('bgcolor') );
93						});
94					}
95				},
96				slideChange : function(){
97					switch_color(this.activeIndex);
98				}
99			}
100		}
101
102		/*
103		// manually change effect swiper not allow change effect on breakpoint option
104		if($(window).width() >= 1024){
105			slider_options.longSwipesRatio = 0;
106		}
107		*/
108
109		// init swiper
110		var swiper = new Swiper($slider, slider_options);
111
112		// autoplay setting
113		$('.jt-popup__control .swiper_play_state').on('click', function(){
114			if($(this).hasClass('play')){
115				swiper.autoplay.stop();
116				$(this).removeClass('play').addClass('pause');
117			} else {
118				swiper.autoplay.start();
119				$(this).removeClass('pause').addClass('play');
120			}
121		});
122
123		/*
124		$('.jt-popup__control .swiper-pagination-bullet').on('click', function(){
125			var $play_btn = $(this).parent().siblings('.swiper_play_state');
126			if($play_btn.hasClass('play')){
127				swiper.autoplay.stop();
128				$play_btn.removeClass('play').addClass('pause');
129			}
130		});
131		*/
132
133	});
134}
135
136
137
138function jt_popup_setting(){
139
140	// resize
141	var init_win_width = $(window).width();
142	var resize_sniff_init  = function(){
143
144		if( !!$('#jt-popup--strap').length ){
145
146            var slide = $('#jt-popup--strap .swiper-container')[0].swiper;
147
148			if( $(window).width() < 1024 ) { // to mobile
149                if(typeof slide != "undefined" && slide.params.effect != 'fade'){
150                    slide.destroy();
151                    jt_popup_slider(false);
152                }
153			} else { // to pc
154			    if(typeof slide != "undefined" && slide.params.effect != 'slide'){
155                    slide.destroy();
156                    jt_popup_slider(false);
157                }
158			}
159
160		}
161
162	}
163
164	// resize_sniff_init();
165	$(window).on('resize', resize_sniff_init);
166
167}
168
169
170
171function jt_popup_close(){
172
173    $('.jt-popup__close').on('click',function(){
174
175        var $this   = $( this );
176	    var $parent = $this.closest( '.jt-popup' );
177	    var hide_key_type = "";
178
179        // hide
180	    $parent.hide();
181		$('body').removeClass('show_popup');
182
183		// display only once in this tab
184        if($parent.hasClass('jt-popup--strap')){
185            hide_key_type = "hide_popup_strap";
186        }
187
188        JT.cookies.create('hide_popup_strap','hide',1);
189
190	});
191
192}
193
194
195
196});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.