diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index b13ed094c2..635b6cceb3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -28,7 +28,8 @@ }); [% IF tab %] - $('#addbibliotabs').selectTabByID("tab[% tab | html %]"); + link = $("a[href='#[% tab | html %]']"); + selectTab( link ); [% END %] Sticky = $("#toolbar"); @@ -136,12 +137,7 @@ $(".toolbar-tabs a").on("click",function(e){ e.preventDefault(); - $(".toolbar-tabs li").removeClass("selected"); - $(this).parent().addClass("selected"); - var tabid = $(this).data("tabid"); - $('#addbibliotabs').selectTabByID("tab" + tabid + "XX"); - $(".tag_anchors").removeClass("tab_selected").hide(); - $(".tag_anchors_" + tabid ).addClass("tab_selected").show(); + selectTab( $(this ) ); }); $(".tag_anchor").on("click", function(e){ @@ -158,6 +154,15 @@ }); + function selectTab( tablink ){ + $(".toolbar-tabs li").removeClass("selected"); + tablink.parent().addClass("selected"); + var tabid = tablink.data("tabid"); + $('#addbibliotabs').selectTabByID("#tab" + tabid + "XX"); + $(".tag_anchors").removeClass("tab_selected").hide(); + $(".tag_anchors_" + tabid ).addClass("tab_selected").show(); + } + function redirect(dest){ $("#redirect").attr("value",dest); return Check(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index d86b994f1f..70e0551b8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -31,7 +31,7 @@ $.fn.tabIndex = function () { return $(this).parent().children('div').index(this); }; $.fn.selectTabByID = function (tabID) { - $(this).tabs("option", "active", $( "#" + tabID ).tabIndex()); + $(this).tabs("option", "active", $( tabID ).tabIndex()); }; $(document).ready(function() {