PageSourceSearch

https://traffic4you.ru/assets/656d38a/js/original/animate-elements.js

js traffic4you.ru collected 2026-10-04 23:25:38 UTC 3,190 bytes, 127 lines download raw bytes

1/* !Animation Core */
2
3/*
4 * Viewport - jQuery selectors for finding elements in viewport
5 *
6 * Copyright (c) 2008-2009 Mika Tuupola
7 *
8 * Licensed under the MIT license:
9 *   http://www.opensource.org/licenses/mit-license.php
10 *
11 * Project home:
12 *  http://www.appelsiini.net/projects/viewport
13 *
14 */
15
16(function($) {
17
18	$.belowthefold = function(element, settings) {
19		var fold = $(window).height() + $(window).scrollTop();
20		return fold <= $(element).offset().top - settings.threshold;
21	};
22	$.abovethetop = function(element, settings) {
23		var top = $(window).scrollTop();
24		return top >= $(element).offset().top + $(element).height() - settings.threshold;
25	};
26	$.rightofscreen = function(element, settings) {
27		var fold = $(window).width() + $(window).scrollLeft();
28		return fold <= $(element).offset().left - settings.threshold;
29	};
30	$.leftofscreen = function(element, settings) {
31		var left = $(window).scrollLeft();
32		return left >= $(element).offset().left + $(element).width() - settings.threshold;
33	};
34	$.inviewport = function(element, settings) {
35		return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings);
36	};
37
38	$.extend($.expr[':'], {
39		"below-the-fold": function(a, i, m) {
40			return $.belowthefold(a, {threshold : 0});
41		},
42		"above-the-top": function(a, i, m) {
43			return $.abovethetop(a, {threshold : 0});
44		},
45		"left-of-screen": function(a, i, m) {
46			return $.leftofscreen(a, {threshold : 0});
47		},
48		"right-of-screen": function(a, i, m) {
49			return $.rightofscreen(a, {threshold : 0});
50		},
51		"in-viewport": function(a, i, m) {
52			return $.inviewport(a, {threshold : -30});
53		}
54	});
55
56})(jQuery);
57
58
59jQuery(document).ready(function($) {
60
61	if(!dtGlobals.isMobile){
62		$("body").addClass("no-mobile");
63	};
64	if(dtGlobals.isiPhone){
65		$("body").addClass("is-iphone");
66	};
67
68	// !- Skills
69	$.fn.animateSkills = function() {
70		$(".skill-value", this).each(function () {
71			var $this = $(this),
72				$this_data = $this.data("width");
73
74			$this.css({
75				width: $this_data + '%'
76			});
77		});
78	};
79
80	// !- Animation "onScroll" loop
81	function doAnimation() {
82		if(!dtGlobals.isMobile){
83			var j = -1;
84			$(".animate-element:not(.start-animation):in-viewport").each(function () {
85				var $this = $(this);
86	
87				if (!$this.hasClass("start-animation") && !$this.hasClass("animation-triggered")) {
88					$this.addClass("animation-triggered");
89					j++;
90					setTimeout(function () {
91						$this.addClass("start-animation");
92						if($this.hasClass("skills")){
93							$this.animateSkills();
94						};
95					}, 200 * j);
96				};
97			});
98		}
99		else {
100			$(".skills").animateSkills();
101		};
102	};
103
104
105	// !- Fire animation
106	doAnimation();
107	if (!dtGlobals.isMobile && !$("html").hasClass("old-ie")){
108		$(window).on("scroll", function () {
109			doAnimation();
110		});
111	};
112
113	// !... and ensute it will work in tabs
114	$(".tab").on("click", function(){
115		if(!dtGlobals.isMobile){
116			$(".animate-element", this).each(function (i) {
117				var $this = $(this);
118				if (!$this.hasClass("start-animation")) {
119					setTimeout(function () {
120						$this.addClass("start-animation");
121					}, 100 * i);
122				}
123			});
124		}
125	});
126
127});

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.