Bug 7466 - Cart notification popup should appear onscreen even when button isn't
authorOwen Leonard <oleonard@myacpl.org>
Tue, 24 Jan 2012 20:46:20 +0000 (15:46 -0500)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 3 Feb 2012 16:34:40 +0000 (17:34 +0100)
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 <aleksa@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/js/basket.js
koha-tmpl/opac-tmpl/prog/en/js/basket.js

index 3a09f64..5b96c12 100644 (file)
@@ -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);
index c83e001..76d668b 100644 (file)
@@ -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;