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/kemi.komma.pro/resources/assets/js/site/reference.js
/* ==========================================================================
 Navigation handler
 ========================================================================== */

/**
 * Main navigation
 */
var Reference = {

    // Initialize click event
    interval : null,

    init : function()
    {
        $('body.references .refBlock .left ul.refs li span').bind('click',function(ev) {
            Reference.showReference($(ev.target).parent().data('refId'));
            $(ev.target).parent().addClass('active').siblings().removeClass('active');
        });

        this.interval = this.initInterval();
    },

    showReference : function(id) {
        $('body.references .refBlock .right #refItem-'+id).addClass('active').siblings().removeClass('active');
        $('body.references .refBlock .refItem.active .quote:first-child').addClass('active').siblings().removeClass('active');
        clearInterval(this.interval);
        this.interval = this.initInterval();
    },

    initInterval : function(){
        return setInterval(function () {
            var $next = $('body.references .refBlock .refItem.active .quote.active').next();
            if( $next.length === 0 ) { $next = $('body.references .refBlock .refItem.active .quote').first(); }
            $next.addClass('active').siblings().removeClass('active');
        }, 4000);
    }


};

Reference.init();