From d93612ced8e0060e908c42eb521742a8785139c3 Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Tue, 21 Aug 2012 17:44:23 +0530 Subject: [PATCH] Bind the language links using jquery on and not in loop Change-Id: Ic4d2dd2b06acae57060bced9938a219bf8cebd73 --- src/jquery.uls.lcd.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 9b3c062..e7e291f 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -82,12 +82,6 @@ } $column.append( $li ); - - if ( that.options.clickhandler ) { - $li.click( function() { - that.options.clickhandler.call( this, langCode ); - } ); - } } }, /** @@ -144,6 +138,11 @@ listen: function() { var that = this; + if ( this.options.clickhandler ) { + this.$element.on( 'click', 'div.row li', function() { + that.options.clickhandler.call( this, $( this ).data( 'code' ) ); + } ); + } // The region section need to be in sync with the map filter. that.$element.scroll( function () { var inviewRegion = that.$element.find( 'div.uls-lcd-region-section:first' ).attr( 'id' );