(function()()

in js/custom.js [879:934]


(function() {

    var defaults = {
        sym: '<i class="icon-up-open"></i>',
        min: 50,
        inDelay:600,
        outDelay:400,
        containerID: 'to-top',
        containerCLASS: 'iconWrapper',
        containerHoverID: 'to-top',
        scrollSpeed: 300,
        easingType: 'linear'
    },
    settings = $.extend(defaults),
    containerIDhash = '#' + settings.containerID,
    containerHoverIDHash = '#'+settings.containerHoverID;

    $('body').append('<a href="#" id="'+settings.containerID+'" class="'+settings.containerCLASS+'">'+settings.sym+'</a>');
    $(containerIDhash).hide().on('click.UItoTop',function(){
        $('html, body').animate({
            scrollTop:0
        }, settings.scrollSpeed, settings.easingType);
        $('#'+settings.containerHoverID, this).stop().animate({
            'opacity': 0
        }, settings.inDelay, settings.easingType);
        return false;
    })
    //.prepend('<span class="'+settings.containerHoverID+'"></span>')
    .hover(function() {

        $(containerHoverIDHash, this).stop().animate({
            'opacity': 1
        }, 600, 'linear');
    }, function() { 


        $(containerHoverIDHash, this).stop().animate({
            'opacity': 0
        }, 700, 'linear');
    });

    $(window).scroll(function() {
        var sd = $(window).scrollTop();
        if(typeof document.body.style.maxHeight === "undefined") {
            $(containerIDhash).css({
                'position': 'absolute',
                'top': sd + $(window).height() - 50
            });
        }
        if ( sd > settings.min ) 
            $(containerIDhash).fadeIn(settings.inDelay);
        else 
            $(containerIDhash).fadeOut(settings.Outdelay);
    });

})();