From 83ccb14e284f1ef3fe0c78ce705fa8fb15bb505a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 3 Sep 2013 02:05:06 +0200 Subject: UI: add arrow to scroll to bottom or to scroll to top --- ishtar_common/static/js/ishtar.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ishtar_common/static/js/ishtar.js') diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index c26c8a7d9..08e500425 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -23,7 +23,6 @@ beforeSend: function(xhr, settings) { } }}); - $(document).ready(function(){ $("#main_menu > ul > li > ul").hide(); $("#main_menu ul ul .selected").parents().show(); @@ -38,6 +37,18 @@ $(document).ready(function(){ {item:'operation', value:$("#current_operation").val()} ); }); + if ($(document).height() < 1.5*$(window).height()){ + $('#to_bottom_arrow').hide(); + $('#to_top_arrow').hide(); + } +}); + +$('#to_bottom_arrow').live('click', function(){ + $("html, body").animate({ scrollTop: $(document).height() }, 1000); +}); + +$('#to_top_arrow').live('click', function(){ + $("html, body").animate({ scrollTop: 0}, 1000); }); $("#main_menu ul li").live('click', function(){ -- cgit v1.2.3