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/topswtw.komma.pro/wwwroot/js/app/modules/productDiscountNotifier.js
define([],function()
{
    $(function(){
        $('.product-block .discount-notifier').each(function(){

            var $items = $('.notifier-items > li', this);
            var $navigation = $('.notifier-navigation > li', this);

            var currentSlide = 0;
            var nItems = $items.length;
            var slideTime = 5000;

            var showItem = function(imageNumber){
                $items.removeClass('active');
                $navigation.removeClass('active');
                $items.eq(imageNumber).addClass('active');
                $navigation.eq(imageNumber).addClass('active');
            };

            var nextItem = function(){
                if(++ currentSlide >= nItems) currentSlide = 0;
                showItem(currentSlide);
            };

            $(document).on('ProductNotifierIntervalEvent', function(e){
                nextItem();
            });
        });

        setInterval(function(){
            $(document).trigger('ProductNotifierIntervalEvent');
        }, 5000);
    });


});