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/customers.js
/**
 * Created by Pascal on 30/11/16.
 */

$(function () {

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

    $(window).resize(
        $.throttle( 250, resizeCases )
    );
    resizeCases();

    $('.cases .tabs .label').click(function () {
        var id = $(this).data('case');

        $('.cases .tabs .label').removeClass('active');
        $(this).addClass('active');

        $('.cases .case.active').removeClass('active');
        $('.cases .case[data-case='+id+']').addClass('active');
        resizeCases();
    });

    $('.more-logos .button').click(function () {

        // Get how many are visible and add 8
        var visible = $(this).data('visible');
        visible += 8;

        // Update data property
        $(this).data('visible', visible);

        var amountLogo = $('.customer-logo').length;

        // Loop through logos and remove class hidden if it should be visible
        $('.customer-logo').each(function (index) {
            var length = index + 1;
            if(length <= visible) $(this).removeClass('hidden');
        });

        // If all logos are visible, hide more button
        if(visible >= amountLogo) $('.more-logos').addClass('hidden');

    });

});

function resizeCases() {

    $('.cases .cases-placeholder').height($('.cases .case.active').height());

}