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/SBogers7/bogers-tekenburo.nl/wwwroot/public/js/simpleGallery.js
var $gal = $('#simple_gallery');
var index = 0;

// Set width ul
var imgW = $('img',$gal).width();
var num = $gal.children().size();
$gal.width((num+1) * imgW);

// Append first image at the end
var first = '<li>' + $gal.children('li').eq(0).html() + '</li>';
$gal.append(first);

setInterval(nextImage,4000);

function nextImage()
{
    index++;
    var newW = index * -imgW;
    $gal.stop().animate({ left: newW + 'px'},500,function()
    {
        // Callback
        if(newW == (num * imgW * -1))
        {
            $gal.css({ left: 0 });
            index = 0;
        }
    });
}