/**
@author Oleg Krasnov (krasnov@artlebedev.ru)
@created 2019.01.28
@copyright Art. Lebedev Studio (http://www.artlebedev.ru/)
This source code follows Formatting section of Google Javascript Style Guide
https://google.github.io/styleguide/jsguide.html#formatting
*/
/**
* @constructor
*/
PromoDDCP = function() {
/**
* @type {!jQuery}
* @private
*/
this.root_ = jQuery('#page');
/**
* @type {!jQuery}
* @private
*/
this.circles = this.root_.find('.ddcp_circle');
// this.init_();
this.attachEvents_()
};
/**
* @private
*/
PromoDDCP.prototype.init_ = function() {
for (var i = 0; i < this.circles.length; i++) {
}
};
/**
* @private
*/
PromoDDCP.prototype.attachEvents_ = function() {
var that = this;
var prevActive = 0;
var currentActive = 0;
jQuery(window).scroll(function() {
var windowScrollTop = jQuery(window).scrollTop();
var windowHeight = jQuery(window).height();
for (var i = 0; i < that.circles.length; i ++) {
var circle = that.circles.eq(i);
var circlesPosition = circle.offset().top;
if (windowScrollTop + (windowHeight / 2) > circlesPosition) {
circle.addClass('viewport');
} else circle.removeClass('viewport');
}
});
};
jQuery(document).ready(function() {
new PromoDDCP();
});