HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/rentman.komma.pro/wwwroot/js/featureLanding.js
/**
 * Created by Pascal on 30/11/16.
 */

$(function () {

    // Detect if throttle and debounce function are init
    if (typeof $.throttle === "undefined") rebindThrottleDebounce();

    var distance = $('.landing-features').offset().top;

    $(window).resize($.throttle(10, function (e) {
        distance = $('.landing-features').offset().top;
        if($('.landing-features').width() < 1440){
            $('.landing-features .landing-features-nav').width($('.landing-features').width());
        }
        else{
            $('.landing-features .landing-features-nav').width(1440);
        }
    }));


    $(window).scroll($.throttle(10, function (e) {

        if($(window).scrollTop() >= (distance-100)){
            $('.landing-features').addClass('sticky-nav');
        }
        else{
            $('.landing-features').removeClass('sticky-nav');
        }

        var activeSection = '';
        var fullVisible ='';
        $('.landing-features .project-landings-item').each(function () {
            if (isElementPartInViewport($(this))) activeSection = $(this).attr('id');
            if (isElementFullInViewport($(this))) fullVisible = $(this).attr('id');
        });

        if(fullVisible!= '') activeSection = fullVisible;

        $('.landing-features .landing-features-nav .active').removeClass('active');
        $('.landing-features .landing-features-nav #'+activeSection+'-nav').addClass('active');

    }));
});