Team:TU-Eindhoven/Template:BaseFooter

From 2013.igem.org

(Difference between revisions)
Line 20: Line 20:
});
});
$('.tue-content h2:not(.well h2, .thumbnail h2, .tue-content h2:first), .tue-content h3:not(.well h3, .thumbnail h3, .tue-memberright)').append('<a href="#top" class="tue-upbutton" title="Go to the top of the page"><i class="icon-arrow-up"></i></a>');
$('.tue-content h2:not(.well h2, .thumbnail h2, .tue-content h2:first), .tue-content h3:not(.well h3, .thumbnail h3, .tue-memberright)').append('<a href="#top" class="tue-upbutton" title="Go to the top of the page"><i class="icon-arrow-up"></i></a>');
 +
$(function () {
 +
 +
    /* set variables locally for increased performance */
 +
    var scroll_timer;
 +
    var displayed = false;
 +
    var $message = $('.tue-gototop-sticky');
 +
    var $window = $(window);
 +
    var top = $(document.body).children(0).position().top;
 +
 +
    /* react to scroll event on window */
 +
    $window.scroll(function () {
 +
        window.clearTimeout(scroll_timer);
 +
        scroll_timer = window.setTimeout(function () {
 +
            if($window.scrollTop() <= top)
 +
            {
 +
                displayed = false;
 +
                $message.fadeOut(500);
 +
            }
 +
            else if(displayed == false)
 +
            {
 +
                displayed = true;
 +
                $message.stop(true, true).show().click(function () { $message.fadeOut(500); });
 +
            }
 +
        }, 100);
 +
    });
 +
});
</script>
</script>
</html>
</html>

Revision as of 21:53, 28 July 2013