From 31bd5c43db099c2bf230d4c6fe27cd2bf0a14e1b Mon Sep 17 00:00:00 2001 From: NikG Date: Thu, 10 Nov 2022 17:44:54 +0200 Subject: [PATCH] Set navigation index to the selected language item index on hover --- src/jquery.uls.lcd.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 858c692..b6568b6 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -503,6 +503,18 @@ listen: function () { var lcd = this; + this.$element.on( 'mouseenter', '.row li', function () { + lcd.navigationIndex = $( this ).index(); + lcd.highlightLanguageOption(); + } ); + + this.$element.on( 'mouseleave', '.row li', function () { + if ( lcd.navigationIndex === $( this ).index() ) { + lcd.navigationIndex = null; + lcd.getLanguageOptionListItems().removeClass( 'language-option--highlighted' ); + } + } ); + if ( this.options.clickhandler ) { this.$element.on( 'click', '.row li', function ( event ) { lcd.options.clickhandler.call( this, $( this ).data( 'code' ), event );