Bug 26039: Focus and Scroll to ShelfBrowser on load
[koha-equinox.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-detail.tt
index 6d9bc45..f8dce1e 100644 (file)
                             [% ITEM_RESULT.itemcallnumber | html %]
                             [% IF ( OPACShelfBrowser ) %]
                                 [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %]
-                                    (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | html %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | html %]#[% tab | html %]">Browse shelf</a>)
+                                    (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | html %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | html %]#[% tab | html %]">Browse shelf<span class="hidden"> (Opens below)</span></a>)
                                 [% ELSE %]
-                                    (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | uri %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | uri %]#[% tab | uri %]">Browse shelf</a>)
+                                    (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | uri %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | uri %]#[% tab | uri %]">Browse shelf<span class="hidden"> (Opens below)</span></a>)
                                 [% END %]
                             [% END %]
                         [% END %]
     [% END %]
 
 [% IF ( OPACShelfBrowser ) %]
+    // Focus on shelf browser if present
+    var shelfbrowser = $("#shelfbrowser");
+    if (shelfbrowser.length > 0) {
+        $('html,body').animate({
+            scrollTop: shelfbrowser.first().offset().top
+        },
+        'slow');
+        shelfbrowser.first().find(':focusable').eq(0).focus();
+    }
 
     (function prepareShelfBrowser(){