PageSourceSearch

https://alessandropagano.net/wp-content/themes/kerge/js/page-animations.js?ver=2.2.2

js alessandropagano.net collected 2026-09-25 23:44:37 UTC 17,534 bytes, 470 lines download raw bytes

1/*
2* Theme Name: Kerge - Responsive vCard
3* Author: lmpixels
4* Author URL: http://themeforest.net/user/lmpixels
5* Version: 2.2.2
6*/
7
8var PageTransitions = (function ($, options) {
9"use strict";
10    var sectionsContainer = $(".subpages"),
11        CurrentAnimating = false,
12        NextAnimating = false,
13        animEndEventNames = {
14            'WebkitAnimation'   : 'webkitAnimationEnd',
15            'OAnimation'        : 'oAnimationEnd',
16            'msAnimation'       : 'MSAnimationEnd',
17            'animation'         : 'animationend'
18        },
19
20        // animation end event name
21        animEndEventName = animEndEventNames[Modernizr.prefixed('animation')],
22
23        // support css animations
24        support = Modernizr.cssanimations;
25
26    function getActiveSection() {
27        if(location.hash === "") {
28            return location.hash = $('section.pt-page').first().attr('data-id');
29        } else {
30            return location.hash.split('/')[0];
31        }
32    }
33
34    function activeMenuItem(item) {
35        if ( !item ) {
36            return false;
37        }
38
39        var navLink = $(item);
40        navLink = navLink['0'];
41        navLink = $(navLink.parentNode);
42            
43        if(navLink) {
44            $('ul.site-auto-menu li').removeClass('active');
45            navLink.addClass('active');
46        }
47    }
48
49    function Animate($pageTrigger, gotoPage) {
50        // Checking for 'data-animation' attribute.
51        var autoMenu = $('.site-auto-menu');
52        if (!(autoMenu.attr('data-animation'))) {
53            var animation = parseInt(Math.floor(Math.random() * 67) + 1).toString();
54        } else {
55            var animation = autoMenu.data('animation').toString();
56        }
57
58        var gotoPage, inClass, outClass, selectedAnimNumber;
59
60         // Check if the delimiter '-' is present then create an animation array list.
61        if(animation.indexOf('-') != -1) {
62            var randomAnimList = animation.split('-');
63            selectedAnimNumber = parseInt(randomAnimList[(Math.floor(Math.random() * randomAnimList.length))]);
64        }
65        else {
66            selectedAnimNumber = parseInt(animation);
67        }
68
69        // Checking if the animation number is out of bound, max allowed value is 1 to 67.
70        if (selectedAnimNumber > 67) {
71            alert("Transition.js : Invalid 'data-animation' attribute configuration. Animation number should not be greater than 67");
72            return false;
73        }
74
75        switch(selectedAnimNumber) {
76            case 1:
77                inClass = 'pt-page-moveFromRight';
78                outClass = 'pt-page-moveToLeft';
79                break;
80            case 2:
81                inClass = 'pt-page-moveFromLeft';
82                outClass = 'pt-page-moveToRight';
83                break;
84            case 3:
85                inClass = 'pt-page-moveFromBottom';
86                outClass = 'pt-page-moveToTop';
87                break;
88            case 4:
89                inClass = 'pt-page-moveFromTop';
90                outClass = 'pt-page-moveToBottom';
91                break;
92            case 5:
93                inClass = 'pt-page-moveFromRight pt-page-ontop';
94                outClass = 'pt-page-fade';
95                break;
96            case 6:
97                inClass = 'pt-page-moveFromLeft pt-page-ontop';
98                outClass = 'pt-page-fade';
99                break;
100            case 7:
101                inClass = 'pt-page-moveFromBottom pt-page-ontop';
102                outClass = 'pt-page-fade';
103                break;
104            case 8:
105                inClass = 'pt-page-moveFromTop pt-page-ontop';
106                outClass = 'pt-page-fade';
107                break;
108            case 9:
109                inClass = 'pt-page-moveFromRightFade';
110                outClass = 'pt-page-moveToLeftFade';
111                break;
112            case 10:
113                inClass = 'pt-page-moveFromLeftFade';
114                outClass = 'pt-page-moveToRightFade';
115                break;
116            case 11:
117                inClass = 'pt-page-moveFromBottomFade';
118                outClass = 'pt-page-moveToTopFade';
119                break;
120            case 12:
121                inClass = 'pt-page-moveFromTopFade';
122                outClass = 'pt-page-moveToBottomFade';
123                break;
124            case 13:
125                inClass = 'pt-page-moveFromRight';
126                outClass = 'pt-page-moveToLeftEasing pt-page-ontop';
127                break;
128            case 14:
129                inClass = 'pt-page-moveFromLeft';
130                outClass = 'pt-page-moveToRightEasing pt-page-ontop';
131                break;
132            case 15:
133                inClass = 'pt-page-moveFromBottom';
134                outClass = 'pt-page-moveToTopEasing pt-page-ontop';
135                break;
136            case 16:
137                inClass = 'pt-page-moveFromTop';
138                outClass = 'pt-page-moveToBottomEasing pt-page-ontop';
139                break;
140            case 17:
141                inClass = 'pt-page-moveFromRight pt-page-ontop';
142                outClass = 'pt-page-scaleDown';
143                break;
144            case 18:
145                inClass = 'pt-page-moveFromLeft pt-page-ontop';
146                outClass = 'pt-page-scaleDown';
147                break;
148            case 19:
149                inClass = 'pt-page-moveFromBottom pt-page-ontop';
150                outClass = 'pt-page-scaleDown';
151                break;
152            case 20:
153                inClass = 'pt-page-moveFromTop pt-page-ontop';
154                outClass = 'pt-page-scaleDown';
155                break;
156            case 21:
157                inClass = 'pt-page-scaleUpDown pt-page-delay300';
158                outClass = 'pt-page-scaleDown';
159                break;
160            case 22:
161                inClass = 'pt-page-scaleUp pt-page-delay300';
162                outClass = 'pt-page-scaleDownUp';
163                break;
164            case 23:
165                inClass = 'pt-page-scaleUp';
166                outClass = 'pt-page-moveToLeft pt-page-ontop';
167                break;
168            case 24:
169                inClass = 'pt-page-scaleUp';
170                outClass = 'pt-page-moveToRight pt-page-ontop';
171                break;
172            case 25:
173                inClass = 'pt-page-scaleUp';
174                outClass = 'pt-page-moveToTop pt-page-ontop';
175                break;
176            case 26:
177                inClass = 'pt-page-scaleUp';
178                outClass = 'pt-page-moveToBottom pt-page-ontop';
179                break;
180            case 27:
181                inClass = 'pt-page-scaleUpCenter pt-page-delay400';
182                outClass = 'pt-page-scaleDownCenter';
183                break;
184            case 28:
185                inClass = 'pt-page-moveFromRight pt-page-delay200 pt-page-ontop';
186                outClass = 'pt-page-rotateRightSideFirst';
187                break;
188            case 29:
189                inClass = 'pt-page-moveFromLeft pt-page-delay200 pt-page-ontop';
190                outClass = 'pt-page-rotateLeftSideFirst';
191                break;
192            case 30:
193                inClass = 'pt-page-moveFromTop pt-page-delay200 pt-page-ontop';
194                outClass = 'pt-page-rotateTopSideFirst';
195                break;
196            case 31:
197                inClass = 'pt-page-moveFromBottom pt-page-delay200 pt-page-ontop';
198                outClass = 'pt-page-rotateBottomSideFirst';
199                break;
200            case 32:
201                inClass = 'pt-page-flipInLeft pt-page-delay500';
202                outClass = 'pt-page-flipOutRight';
203                break;
204            case 33:
205                inClass = 'pt-page-flipInRight pt-page-delay500';
206                outClass = 'pt-page-flipOutLeft';
207                break;
208            case 34:
209                inClass = 'pt-page-flipInBottom pt-page-delay500';
210                outClass = 'pt-page-flipOutTop';
211                break;
212            case 35:
213                inClass = 'pt-page-flipInTop pt-page-delay500';
214                outClass = 'pt-page-flipOutBottom';
215                break;
216            case 36:
217                inClass = 'pt-page-scaleUp';
218                outClass = 'pt-page-rotateFall pt-page-ontop';
219                break;
220            case 37:
221                inClass = 'pt-page-rotateInNewspaper pt-page-delay500';
222                outClass = 'pt-page-rotateOutNewspaper';
223                break;
224            case 38:
225                inClass = 'pt-page-moveFromRight';
226                outClass = 'pt-page-rotatePushLeft';
227                break;
228            case 39:
229                inClass = 'pt-page-moveFromLeft';
230                outClass = 'pt-page-rotatePushRight';
231                break;
232            case 40:
233                inClass = 'pt-page-moveFromBottom';
234                outClass = 'pt-page-rotatePushTop';
235                break;
236            case 41:
237                inClass = 'pt-page-moveFromTop';
238                outClass = 'pt-page-rotatePushBottom';
239                break;
240            case 42:
241                inClass = 'pt-page-rotatePullRight pt-page-delay180';
242                outClass = 'pt-page-rotatePushLeft';
243                break;
244            case 43:
245                inClass = 'pt-page-rotatePullLeft pt-page-delay180';
246                outClass = 'pt-page-rotatePushRight';
247                break;
248            case 44:
249                inClass = 'pt-page-rotatePullBottom pt-page-delay180';
250                outClass = 'pt-page-rotatePushTop';
251                break;
252            case 45:
253                inClass = 'pt-page-rotatePullTop pt-page-delay180';
254                outClass = 'pt-page-rotatePushBottom';
255                break;
256            case 46:
257                inClass = 'pt-page-moveFromRightFade';
258                outClass = 'pt-page-rotateFoldLeft';
259                break;
260            case 47:
261                inClass = 'pt-page-moveFromLeftFade';
262                outClass = 'pt-page-rotateFoldRight';
263                break;
264            case 48:
265                inClass = 'pt-page-moveFromBottomFade';
266                outClass = 'pt-page-rotateFoldTop';
267                break;
268            case 49:
269                inClass = 'pt-page-moveFromTopFade';
270                outClass = 'pt-page-rotateFoldBottom';
271                break;
272            case 50:
273                inClass = 'pt-page-rotateUnfoldLeft';
274                outClass = 'pt-page-moveToRightFade';
275                break;
276            case 51:
277                inClass = 'pt-page-rotateUnfoldRight';
278                outClass = 'pt-page-moveToLeftFade';
279                break;
280            case 52:
281                inClass = 'pt-page-rotateUnfoldTop';
282                outClass = 'pt-page-moveToBottomFade';
283                break;
284            case 53:
285                inClass = 'pt-page-rotateUnfoldBottom';
286                outClass = 'pt-page-moveToTopFade';
287                break;
288            case 54:
289                inClass = 'pt-page-rotateRoomLeftIn';
290                outClass = 'pt-page-rotateRoomLeftOut pt-page-ontop';
291                break;
292            case 55:
293                inClass = 'pt-page-rotateRoomRightIn';
294                outClass = 'pt-page-rotateRoomRightOut pt-page-ontop';
295                break;
296            case 56:
297                inClass = 'pt-page-rotateRoomTopIn';
298                outClass = 'pt-page-rotateRoomTopOut pt-page-ontop';
299                break;
300            case 57:
301                inClass = 'pt-page-rotateRoomBottomIn';
302                outClass = 'pt-page-rotateRoomBottomOut pt-page-ontop';
303                break;
304            case 58:
305                inClass = 'pt-page-rotateCubeLeftIn';
306                outClass = 'pt-page-rotateCubeLeftOut pt-page-ontop';
307                break;
308            case 59:
309                inClass = 'pt-page-rotateCubeRightIn';
310                outClass = 'pt-page-rotateCubeRightOut pt-page-ontop';
311                break;
312            case 60:
313                inClass = 'pt-page-rotateCubeTopIn';
314                outClass = 'pt-page-rotateCubeTopOut pt-page-ontop';
315                break;
316            case 61:
317                inClass = 'pt-page-rotateCubeBottomIn';
318                outClass = 'pt-page-rotateCubeBottomOut pt-page-ontop';
319                break;
320            case 62:
321                inClass = 'pt-page-rotateCarouselLeftIn';
322                outClass = 'pt-page-rotateCarouselLeftOut pt-page-ontop';
323                break;
324            case 63:
325                inClass = 'pt-page-rotateCarouselRightIn';
326                outClass = 'pt-page-rotateCarouselRightOut pt-page-ontop';
327                break;
328            case 64:
329                inClass = 'pt-page-rotateCarouselTopIn';
330                outClass = 'pt-page-rotateCarouselTopOut pt-page-ontop';
331                break;
332            case 65:
333                inClass = 'pt-page-rotateCarouselBottomIn';
334                outClass = 'pt-page-rotateCarouselBottomOut pt-page-ontop';
335                break;
336            case 66:
337                inClass = 'pt-page-rotateSidesIn pt-page-delay200';
338                outClass = 'pt-page-rotateSidesOut';
339                break;
340            case 67:
341                inClass = 'pt-page-rotateSlideIn';
342                outClass = 'pt-page-rotateSlideOut';
343                break;
344        }
345
346        // This will get the current subpage
347        var currentPageId = $('section.pt-page-current').attr('data-id'),
348            linkhref = $pageTrigger.attr('href').split("#"),
349            gotoPage = linkhref[1];
350
351        // Check if the current page is same as the next page then do not start the animation
352        if (currentPageId != gotoPage) {
353            var $currentPage = $('section[data-id="' + currentPageId + '"]');
354            if( $currentPage.length ) {
355                CurrentAnimating = true;
356            }
357            NextAnimating = true;
358
359            // Next page to be animated.
360            $currentPage.removeClass('pt-page-relative');
361            var $nextPage = $('section[data-id='+gotoPage+']').addClass('pt-page-current');
362
363            $nextPage.scrollTop(0);
364            $('.site-main').scrollTop(0);
365
366            $currentPage.addClass(outClass).on(animEndEventName, function() {
367                CurrentAnimating = false;
368                $currentPage.attr('class', $currentPage.data('originalClassList'));
369                $currentPage.off(animEndEventName);
370            });
371
372            $nextPage.addClass(inClass).on(animEndEventName, function() {
373                NextAnimating = false;
374                $nextPage.attr('class', $nextPage.data('originalClassList') + ' pt-page-current pt-page-relative');
375                $nextPage.off(animEndEventName);
376            });
377        }
378        // else reset the 'isAnimating' flag
379        else {
380            CurrentAnimating = false;
381            NextAnimating = false;
382        }
383
384
385        // Check if the animation is supported by browser and reset the pages.
386        if(!support) {
387            onEndAnimation($currentPage, $nextPage);
388        }
389
390    }
391
392    function init(options) {
393        // Get all the .pt-page sections.
394        $('.pt-page').each( function() {
395            var $page = $(this);
396            $page.data('originalClassList', $page.attr('class'));
397        });
398
399        // Auto Menu creating
400        var menu_html = "";
401                            
402        $('.pt-wrapper').find('section.pt-page').each(function()
403        {
404            var slug = $(this).attr('data-id');
405            var page_title = $(this).attr('data-title');
406            if(slug.length) {
407                var menu_item = '<li><a href="#' + slug + '" class="pt-trigger">' + page_title + '</a></li>';
408            } else {
409                var menu_item = '';
410            }
411            menu_html += menu_item;
412            $('.site-auto-menu').html(menu_html);
413        });
414
415        // Adding click event to main menu link
416        $('.pt-trigger').click(function() {
417            if( NextAnimating || CurrentAnimating ) {
418                return false;
419            }
420            var pageTrigger = $(this),
421                menuLink = $(this);
422
423            activeMenuItem( menuLink );
424            Animate(pageTrigger);
425            history.pushState('', 'New URL: '+$(this).attr('href'), $(this).attr('href'));
426        });
427
428        window.onpopstate = function (event) {
429            if(location.hash) {
430                if ( NextAnimating == true || CurrentAnimating == true ) {
431                    return false;
432                }
433                var menuLink = $(menu+' a[href*="'+location.hash.split('/')[0]+'"]');
434                activeMenuItem( menuLink );
435                Animate(menuLink);
436            }
437        };
438
439        var menu = options.menu,
440        pageStart = getActiveSection();
441
442        location.hash = pageStart;
443        var menuLink = $(menu+' a[href*="'+location.hash.split('/')[0]+'"]');
444
445        activeMenuItem(menuLink);
446
447        Animate(menuLink);
448
449        $(".lmpixels-arrow-right").click(function() {
450            var activeItem = $('.site-main-menu li.active');
451            activeItem.next("li").children("a").click();
452            if ( activeItem.is(':last-child') ) {
453                $('.site-main-menu li:first-child').children("a").click();
454            }
455        });
456
457        $(".lmpixels-arrow-left").click(function() {
458            var activeItem = $('.site-main-menu li.active');
459            activeItem.prev("li").children("a").click();
460            if ( activeItem.is(':first-child') ) {
461                $('.site-main-menu li:last-child').children("a").click();
462            }
463        });
464    }
465
466    return {
467        init : init,
468    };
469
470})(jQuery);

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.