FitLive Developer Documentation

Snapshot example

Example

Javascript Code

window.onload = function()
{
    var FitLive = Fb.FitLive.GetInstance(
        {
            FitLive:
            {
                container: '#myFitLive',
                onTryon: function()
                {
                    GetSnapshot();
                }
            }
            
        }
    );
    
    var GetSnapshot = function()
    {
        FitLive.GetSnapshot(
            function(pImage)
            {
                var vImage = new Image();
                vImage.src = 'data:image/jpg;base64,' + pImage;
                vImage.width = 232;
                
                $('#fittingbox-fitlive-menu > img').remove();                
                $('#fittingbox-fitlive-menu').append(vImage);
            }
        );
    }
    
    $('#frames img').click(
        function()
        {
            $('#frames img').removeClass('selected');
            $(this).addClass('selected');
            FitLive.SetFrame($(this).attr('rel'));
        }
    );
    $('#frames img:first').click();
}