File "parallax-effect.js"

Full Path: /home/thebyphq/gemsols.co/takemyclassnow/js/modules/parallax-effect.js
File size: 979 bytes
MIME-type: text/plain
Charset: utf-8

jQuery(function ($) {

    if (window.innerWidth > BREAK.LG) {
        $(window).on('scroll', function () {
            $('[data-fixed_top]').each(function () {
                var elementParent = $(this).parent('.is-fixed-container'),
                    elementOffsetTop = elementParent.offset().top,
                    elementStatus = ($(this).hasClass('is-fixed-element')) ? true : false;
                var elementHeight = $(this).outerHeight();
                if ($(window).scrollTop() >= elementOffsetTop && !elementStatus) {
                    elementStatus = true;
                    $(this).addClass('is-fixed-element');
                    elementParent.css('height', elementHeight);
                } else if ($(window).scrollTop() < elementOffsetTop && elementStatus) {
                    $(this).removeClass('is-fixed-element');
                    elementParent.css('height', 'auto');
                }
            })
        })
    }
});