$(window).ready(function () {
    $('div.sliderGallery').each(function () {
        var ul = $('ul', this);
        var productWidth = ul.innerWidth() - $(this).outerWidth();

        var slider = $('.slider', this).slider({
            handle: '.handle',
            min: 0,
            max: productWidth,
            slide: function (ev, ui) {
                ul.css('left', '-' + ui.value + 'px');
                $('#test').html(ui.value);
            },
            stop: function (ev, ui) {
                ul.animate({ 'left' : '-' + ui.value + 'px' }, 500, 'linear');
                $('#test').html(ui.value);
            }
        });

    });
});