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/topswtwmobile.komma.pro/wwwroot/js/plugins/equalHeight.js
define([],function()
{
    $.equalHeight = function(element, options) {

        // Default options
        var defaults = {};

        // Reference to this
        var t = this;

        var $parent = $(element);

        t.boot = function ()
        {
            // Extend the defaults with options, save in settings
            t.settings = $.extend({}, defaults, options);

            $parent.children('div:nth-child(3n + 1)').each(function()
            {
                console.log('update..');
                updateHeight($(this));
            })
        };

        var updateHeight = function($firstElement)
        {
            var $secondElement = $parent.children().eq($firstElement.index() + 1);
            var $thirdElement = $parent.children().eq($firstElement.index() + 2);

            $firstElement.height('auto');
            $secondElement.height('auto');
            $thirdElement.height('auto');

            // Get highest height
            var highestHeight = $firstElement.height();
            if($secondElement.height() > highestHeight) highestHeight = $secondElement.height();
            if($thirdElement.height() > highestHeight) highestHeight = $thirdElement.height();

            $firstElement.height(highestHeight);
            $secondElement.height(highestHeight);
            $thirdElement.height(highestHeight);
        };

        t.removePadding = function()
        {
            $parent.children().each(function() {
               $(this).css({ width: $(this).width()+'px', padding: 0 });
            });

        };

        // Run plugin
        t.boot();
    };

    $.fn.equalHeight = function(options)
    {
        return this.each(function()
        {
            // if plugin has not already been attached to the element
            if ($(this).data('equalHeight') == undefined)
            {
                // create a new instance of the plugin
                $(this).data('equalHeight', new $.equalHeight(this, options));
            }
        });
    }

});