PageSourceSearch

https://www.aconytebooks.com/wp-content/plugins/jetsticky-for-elem…/js/jet-sticky-frontend.js?v=1790082269

js aconytebooks.com collected 2026-09-24 20:19:49 UTC 10,723 bytes, 389 lines download raw bytes

1( function( $, elementor ) {
2
3	'use strict';
4
5	var JetSticky = {
6
7		init: function() {
8			elementor.hooks.addAction( 'frontend/element_ready/column', JetSticky.elementorColumn );
9			elementor.hooks.addAction( 'frontend/element_ready/container', JetSticky.elementorColumn );
10
11			elementorFrontend.hooks.addAction( 'frontend/element_ready/section', JetSticky.setStickySection );
12			elementorFrontend.hooks.addAction( 'frontend/element_ready/container', JetSticky.setStickySection );
13
14			$( JetSticky.stickySection );
15		},
16
17		elementorColumn: function( $scope ) {
18			var $target  = $scope,
19				$window  = $( window ),
20				columnId = $target.data( 'id' ),
21				editMode = Boolean( elementor.isEditMode() ),
22				settings = {},
23				stickyInstance = null,
24				stickyInstanceOptions = {
25					topSpacing: 50,
26					bottomSpacing: 50,
27					containerSelector: '.elementor-section',
28					innerWrapperSelector: '.elementor-widget-wrap',
29				};
30
31			if ( ! editMode ) {
32				settings = $target.data( 'jet-sticky-column-settings' );
33
34				if ( $target.hasClass( 'jet-sticky-column-sticky' ) ) {
35
36					if ( -1 !== settings['stickyOn'].indexOf( elementorFrontend.getCurrentDeviceMode() ) ) {
37
38						$target.each( function() {
39
40							var $this  = $( this ),
41
42							elementType = $this.data( 'element_type' );
43
44							if ( elementType !== 'container' ){
45			
46									stickyInstanceOptions.topSpacing = settings['topSpacing'];
47									stickyInstanceOptions.bottomSpacing = settings['bottomSpacing'];
48
49									$target.data( 'stickyColumnInit', true );
50									stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions );
51
52									$window.on( 'resize.JetStickyColumnSticky orientationchange.JetStickyColumnSticky', JetStickyTools.debounce( 50, resizeDebounce ) );
53							
54							} else {
55								$this.addClass( 'jet-sticky-container-sticky' );
56								$this.css({ 
57									'top': settings['topSpacing'], 
58									'bottom': settings['bottomSpacing']
59								});
60							}
61						});
62					}
63				}
64
65			} else {
66				return false;
67			}
68
69			function resizeDebounce() {
70				var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(),
71					availableDevices  = settings['stickyOn'] || [],
72					isInit            = $target.data( 'stickyColumnInit' );
73
74				if ( -1 !== availableDevices.indexOf( currentDeviceMode ) ) {
75
76					if ( ! isInit ) {
77						$target.data( 'stickyColumnInit', true );
78						stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions );
79						stickyInstance.updateSticky();
80					}
81				} else {
82					$target.data( 'stickyColumnInit', false );
83					stickyInstance.destroy();
84				}
85			}
86
87		},
88
89		columnEditorSettings: function( columnId ) {
90			var editorElements = null,
91				columnData     = {};
92
93			if ( ! window.elementor.hasOwnProperty( 'elements' ) ) {
94				return false;
95			}
96
97			editorElements = window.elementor.elements;
98
99			if ( ! editorElements.models ) {
100				return false;
101			}
102
103			$.each( editorElements.models, function( index, obj ) {
104
105				$.each( obj.attributes.elements.models, function( index, obj ) {
106					if ( columnId == obj.id ) {
107						columnData = obj.attributes.settings.attributes;
108					}
109				} );
110
111			} );
112
113			return {
114				'sticky': columnData['jet_sticky_column_sticky_enable'] || false,
115				'topSpacing': columnData['jet_sticky_column_sticky_top_spacing'] || 50,
116				'bottomSpacing': columnData['jet_sticky_column_sticky_bottom_spacing'] || 50,
117				'stickyOn': columnData['jet_sticky_column_sticky_enable_on'] || [ 'desktop', 'tablet', 'mobile']
118			}
119		},
120
121		getStickySectionsDesktop: [],
122		getStickySectionsTablet:  [],
123		getStickySectionsMobile:  [],
124
125		setStickySection: function( $scope ) {
126			var setStickySection = {
127
128				target: $scope,
129
130				isEditMode: Boolean( elementorFrontend.isEditMode() ),
131
132				init: function() {
133					if ( this.isEditMode ) {
134						return;
135					}
136
137					if (  'yes' === this.getSectionSetting( 'jet_sticky_section_sticky' ) ) {
138						var availableDevices = this.getSectionSetting( 'jet_sticky_section_sticky_visibility' ) || [];
139
140						if ( ! availableDevices[0] ) {
141							return;
142						}
143
144						if ( -1 !== availableDevices.indexOf( 'desktop' ) ) {
145							JetSticky.getStickySectionsDesktop.push( $scope );
146						}
147
148						if ( -1 !== availableDevices.indexOf( 'tablet' ) ) {
149							JetSticky.getStickySectionsTablet.push( $scope );
150						}
151
152						if ( -1 !== availableDevices.indexOf( 'mobile' ) ) {
153							JetSticky.getStickySectionsMobile.push( $scope );
154						}
155					}
156				},
157
158				getSectionSetting: function( setting ){
159					var settings = {},
160						editMode = Boolean( elementorFrontend.isEditMode() );
161
162					if ( editMode ) {
163						if ( ! elementorFrontend.hasOwnProperty( 'config' ) ) {
164							return;
165						}
166
167						if ( ! elementorFrontend.config.hasOwnProperty( 'elements' ) ) {
168							return;
169						}
170
171						if ( ! elementorFrontend.config.elements.hasOwnProperty( 'data' ) ) {
172							return;
173						}
174
175						var modelCID = this.target.data( 'model-cid' ),
176							editorSectionData = elementorFrontend.config.elements.data[ modelCID ];
177
178						if ( ! editorSectionData ) {
179							return;
180						}
181
182						if ( ! editorSectionData.hasOwnProperty( 'attributes' ) ) {
183							return;
184						}
185
186						settings = editorSectionData.attributes || {};
187					} else {
188						settings = this.target.data( 'settings' ) || {};
189					}
190
191					if ( ! settings[ setting ] ) {
192						return;
193					}
194
195					return settings[ setting ];
196				}
197			};
198
199			setStickySection.init();
200		},
201
202		stickySection: function() {
203			var stickySection = {
204
205				isEditMode: Boolean( elementorFrontend.isEditMode() ),
206
207				correctionSelector: $( '#wpadminbar' ),
208
209				initDesktop: false,
210				initTablet:  false,
211				initMobile:  false,
212
213				init: function() {
214
215					var _this = this;
216
217					if ( this.isEditMode ) {
218						return;
219					}
220
221					$( document ).ready( function(){
222						_this.run();
223					} );
224
225					$( window ).on( 'resize.JetStickySection orientationchange.JetStickySection', this.run.bind( this ) );
226				},
227
228				getOffset: function(){
229					var offset = 0;
230
231					if ( this.correctionSelector[0] && 'fixed' === this.correctionSelector.css( 'position' ) ) {
232						offset = this.correctionSelector.outerHeight( true );
233					}
234
235					return offset;
236				},
237
238				run: function() {
239					var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(),
240						transitionIn  = 'jet-sticky-transition-in',
241						transitionOut = 'jet-sticky-transition-out',
242						options = {
243							stickyClass: 'jet-sticky-section-sticky--stuck',
244							topSpacing: this.getOffset()
245						};
246
247					function initSticky ( section, options ) {
248						section.jetStickySection( options )
249							.on( 'jetStickySection:stick', function( event ) {
250								$( event.target ).addClass( transitionIn );
251								setTimeout( function() {
252									$( event.target ).removeClass( transitionIn );
253								}, 3000 );
254							} )
255							.on( 'jetStickySection:unstick', function( event ) {
256								$( event.target ).addClass( transitionOut );
257								setTimeout( function() {
258									$( event.target ).removeClass( transitionOut );
259								}, 3000 );
260							} );
261						section.trigger( 'jetStickySection:activated' );
262					}
263
264					if ( 'desktop' === currentDeviceMode && ! this.initDesktop ) {
265						if ( this.initTablet ) {
266							JetSticky.getStickySectionsTablet.forEach( function( section, i ) {
267								section.trigger( 'jetStickySection:detach' );
268							});
269
270							this.initTablet = false;
271						}
272
273						if ( this.initMobile ) {
274							JetSticky.getStickySectionsMobile.forEach( function( section, i ) {
275								section.trigger( 'jetStickySection:detach' );
276							});
277
278							this.initMobile = false;
279						}
280
281						if ( JetSticky.getStickySectionsDesktop[0] ) {
282							JetSticky.getStickySectionsDesktop.forEach( function( section, i ) {
283
284								if ( JetSticky.getStickySectionsDesktop[i+1] ) {
285									options.stopper = JetSticky.getStickySectionsDesktop[i+1];
286								} else {
287									options.stopper = '';
288								}
289
290								initSticky( section, options );
291							});
292
293							this.initDesktop = true;
294						}
295					}
296
297					if ( 'tablet' === currentDeviceMode && ! this.initTablet ) {
298						if ( this.initDesktop ) {
299							JetSticky.getStickySectionsDesktop.forEach( function( section, i ) {
300								section.trigger( 'jetStickySection:detach' );
301							});
302
303							this.initDesktop = false;
304						}
305
306						if ( this.initMobile ) {
307							JetSticky.getStickySectionsMobile.forEach( function( section, i ) {
308								section.trigger( 'jetStickySection:detach' );
309							});
310
311							this.initMobile = false;
312						}
313
314						if ( JetSticky.getStickySectionsTablet[0] ) {
315							JetSticky.getStickySectionsTablet.forEach( function( section, i ) {
316								if ( JetSticky.getStickySectionsTablet[i+1] ) {
317									options.stopper = JetSticky.getStickySectionsTablet[i+1];
318								} else {
319									options.stopper = '';
320								}
321
322								initSticky( section, options );
323							});
324
325							this.initTablet = true;
326						}
327					}
328
329					if ( 'mobile' === currentDeviceMode && ! this.initMobile ) {
330						if ( this.initDesktop ) {
331							JetSticky.getStickySectionsDesktop.forEach( function( section, i ) {
332								section.trigger( 'jetStickySection:detach' );
333							});
334
335							this.initDesktop = false;
336						}
337
338						if ( this.initTablet ) {
339							JetSticky.getStickySectionsTablet.forEach( function( section, i ) {
340								section.trigger( 'jetStickySection:detach' );
341							});
342
343							this.initTablet = false;
344						}
345
346						if ( JetSticky.getStickySectionsMobile[0] ) {
347							JetSticky.getStickySectionsMobile.forEach( function( section, i ) {
348
349								if ( JetSticky.getStickySectionsMobile[i+1] ) {
350									options.stopper = JetSticky.getStickySectionsMobile[i+1];
351								} else {
352									options.stopper = '';
353								}
354
355								initSticky( section, options );
356							});
357
358							this.initMobile = true;
359						}
360					}
361				}
362			};
363
364			stickySection.init();
365		}
366	};
367
368	$( window ).on( 'elementor/frontend/init', JetSticky.init );
369
370	var JetStickyTools = {
371		debounce: function( threshold, callback ) {
372			var timeout;
373
374			return function debounced( $event ) {
375				function delayed() {
376					callback.call( this, $event );
377					timeout = null;
378				}
379
380				if ( timeout ) {
381					clearTimeout( timeout );
382				}
383
384				timeout = setTimeout( delayed, threshold );
385			};
386		}
387	}
388
389}( jQuery, window.elementorFrontend ) );

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.