From 31f6189f4aa0f2ebcfca9aad774eab20f08a55b3 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 3 Jun 2020 12:58:37 +0200 Subject: [PATCH] LSform: Avoid page scrolling on tab change --- src/includes/js/LSform.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/includes/js/LSform.js b/src/includes/js/LSform.js index df08c68b..2818ed86 100644 --- a/src/includes/js/LSform.js +++ b/src/includes/js/LSform.js @@ -86,6 +86,9 @@ var LSform = new Class({ } } + // Remove corresponding anchor to avoid scrolling on tab change + $$('a[name='+this.getLayoutNameFromBtn(li)+']').dispose(); + li.getFirst('a').addEvent('click',this.onTabBtnClick.bindWithEvent(this,li)); },this); @@ -182,7 +185,10 @@ var LSform = new Class({ li.addClass('LSform_layout_current'); var a=li.getElement('a'); if ($type(a)) { - location.hash='#'+this.getLayoutNameFromBtn(li); + var layout_name = this.getLayoutNameFromBtn(li); + if (layout_name) { + location.hash='#'+layout_name; + } } var div = this.getLayout(li); if ($type(div)) {