function scrollanimation() {
    var scrollY = document.documentElement.scrollTop;
    console.log(scrollY);
    if (scrollY > 0) {
        $('.navbar').addClass('navbar-fixed-top');
        $('.brand-color').hide();
        $('.brand-white').show();
    } else {
        $('.navbar').removeClass('navbar-fixed-top');
        $('.brand-color').show();
        $('.brand-white').hide();
    }
}
var swiper = new Swiper('.swiper-container', {
    spaceBetween: 30,
    centeredSlides: true,
    lazy: true,
    autoplay: {
        delay: 3000,
        disableOnInteraction: true,
    },
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
});
$(".swiper-container").mouseenter(function () {
    swiper.autoplay.stop();
});

$(".swiper-container").mouseleave(function () {
    swiper.autoplay.start();
});

$(window).load(function(){
    var $container = $('.portfoliomasterContainer');
    $container.isotope({
        filter: '*',
        animationOptions: {
            duration: 750,
            easing: 'linear',
            queue: false
        }
    });
 
    $('.portfoliomaster a').click(function(){
        $('.portfoliomaster .current').removeClass('current');
        $(this).addClass('current');
 
        var selector = $(this).attr('data-filter');
        $container.isotope({
            filter: selector,
            animationOptions: {
                duration: 750,
                easing: 'linear',
                queue: false
            }
         });
         return false;
    }); 
});

//progressive-image.js
if (window.addEventListener && window.requestAnimationFrame &&
    document.getElementsByClassName) window.addEventListener(
        'load', function()
        {
           
            // start

            var pItem = document.getElementsByClassName('progressive replace'), timer;

            window.addEventListener('scroll', scroller, false);
            window.addEventListener('resize', scroller, false);
            inView();

            // throttled scroll/resize
            function scroller(e)
            {
                
                timer = timer || setTimeout(function()
                {
                    timer = null;
                    requestAnimationFrame(inView);
                },
                 300);
            }

            // image in view>
            function inView()
            {
                var wT = window.pageYOffset, wB = wT + window.innerHeight, cRect, pT,
                pB, p = 0;

                while (p < pItem.length)
                {
                    cRect = pItem[p].getBoundingClientRect();
                    pT = wT + cRect.top;
                    pB = pT + cRect.height;

                    if (wT < pB && wB > pT)
                    {
                        loadFullImage(pItem[p]);
                        pItem[p].classList.remove('replace');
                    }
                    else p++;
                }
            }

            // replace with full image
            function loadFullImage(item)
            {
                if (!item || !item.href) return;

                // load image
                var img = new Image();
                if (item.dataset)
                {
                    img.srcset = item.dataset.srcset || '';
                    img.sizes = item.dataset.sizes || '';
                }
                img.src = item.href;
                img.className = 'reveal';
                if (img.complete) addImg();
                else img.onload = addImg();

                // replace image
                function addImg()
                {
                    // disable click
                    item.addEventListener('click', function(e) {e.preventDefault(); }, false);

                    // add full image
                    item.appendChild(img).addEventListener('animationed', function(e){

                        //remove preview image
                        var pImg =  item.querySelector &&
                        item.querySelector('img.preview');
                        if (pImg)
                        {
                            e.target.alt = pImg.alt || '';
                            item.removeChild(pImg);
                            e.target.classList.remove('reveal');
                        }
                    });
                }
            }
        },
    false);