﻿function centerBottom(selector) {
    var newTop = $(window).height() - $(selector).height();
    $(selector).css({
        'position': 'fixed',
        'top': newTop
    });
}



$(document).ready(function () {

    centerBottom("#uxNavContenuto");

    // assure that it gets called when the page resizes
    $(window).resize(function () {
        centerBottom('#uxNavContenuto');
        $("#uxNavContenuto").animate().stop();
    });

    var scrollTop = $(window).scrollTop();
    

    $(window).bind('scroll', function () {
        if ($(this).scrollTop() > 350) {
            $("#uxNavContenuto").fadeOut();

        }
    });




    Animazione();





});
function goToByScroll(id) {
    $('html,body').animate({ scrollTop: $("#" + id).offset().top }, 'slow');
    $("#uxNavContenuto").css("display", "none");

}

function Animazione() {
        animate_loop = function () {
            $("#uxNavContenuto").animate({ top: "-=30" }, 500, function () {
                $("#uxNavContenuto").animate({ top: "+=30" }, 500, function () {

                    animate_loop();

                });
            });


        }

        animate_loop();
    }

    function StopAnimazione() {
        var newTop = $(window).height() - $(selector).height();
        $("#uxNavContenuto").css('top', newTop);
    }

    
