From 53be89a5f03664ec64fe98dbd24bc3b8ca12f1d3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 24 Jan 2012 15:46:20 -0500 Subject: [PATCH] Bug 7466 - Cart notification popup should appear onscreen even when button isn't This patch compares the scroll position of the window with the page position of the cart button and displays the cart notification popup at the top of the visible page if the cart button has moved offscreen. Includes fix for OPAC and staff client. Signed-off-by: Aleksa Vujicic Signed-off-by: Paul Poulain (cherry picked from commit 1eb0cbc5bf728f6cdb64b5cf102f227df1efb617) Signed-off-by: Chris Nighswonger --- koha-tmpl/intranet-tmpl/prog/en/js/basket.js | 4 ++++ koha-tmpl/opac-tmpl/prog/en/js/basket.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js index 3a09f64a0c..5b96c1284f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js @@ -422,7 +422,11 @@ function vShelfAdd() { function showCart(){ var position = $("#cartmenulink").offset(); + var scrolld = $(window).scrollTop(); var top = position.top + $("#cartmenulink").outerHeight(); + if( scrolld > top ){ + top = scrolld + 15; + } var left = position.left $("#cartDetails").css("position","absolute").css("top",top); $("#cartDetails").css("position","absolute").css("left",left); diff --git a/koha-tmpl/opac-tmpl/prog/en/js/basket.js b/koha-tmpl/opac-tmpl/prog/en/js/basket.js index c83e00119d..76d668bf13 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/basket.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/basket.js @@ -428,7 +428,11 @@ function vShelfAdd() { function showCart(){ var position = $("#cartmenulink").offset(); + var scrolld = $(window).scrollTop(); var top = position.top + $("#cartmenulink").outerHeight(); + if( scrolld > top ){ + top = scrolld + 15; + } var menuWidth = 200; var buttonWidth = $("#cartmenulink").innerWidth(); var buttonOffset = menuWidth - buttonWidth; -- 2.39.5