jQuery.uls bug fixes and keep template with the plugin
* The jQuery selectors should be referring to the menu for the current ULS instance rather than querying on the page. This allows multiple instances of ULS present in the page * Keep the HTML template with the plugin. No more HTML added from hooks. * Updated the example based on above change. * Updated the hooks code. * Some more documentation. Change-Id: I48e2e167bc2c09b8653a142c50317c22e8ba1362
This commit is contained in:
committed by
Amir E. Aharoni
parent
5bd96823d6
commit
f3ffe8bead
@@ -1,5 +1,7 @@
|
||||
/**
|
||||
* <explain briefly what this file is about>.
|
||||
* Universal Language Selector
|
||||
* Language category display component - Used for showing the search results,
|
||||
* grouped by regions, scripts
|
||||
*
|
||||
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
|
||||
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
|
||||
@@ -97,7 +99,7 @@
|
||||
var $divRegionCode, $rowDiv, $ul;
|
||||
|
||||
forceNew = forceNew || false;
|
||||
$divRegionCode = $( 'div#' + regionCode );
|
||||
$divRegionCode = this.$element.find( 'div#' + regionCode );
|
||||
$rowDiv = $divRegionCode.find( 'div.row:last' );
|
||||
$ul = $divRegionCode.find( 'ul:last' );
|
||||
|
||||
@@ -144,9 +146,9 @@
|
||||
var that = this;
|
||||
// The region section need to be in sync with the map filter.
|
||||
that.$element.scroll( function () {
|
||||
var inviewRegion = $( 'div.uls-lcd-region-section:first' ).attr( 'id' );
|
||||
var inviewRegion = that.$element.find( 'div.uls-lcd-region-section:first' ).attr( 'id' );
|
||||
var listtop = that.$element.position().top;
|
||||
$( 'div.uls-lcd-region-section' ).each( function () {
|
||||
that.$element.find( 'div.uls-lcd-region-section' ).each( function () {
|
||||
var offset = $( this ).position().top - listtop;
|
||||
if ( offset < 0 ) {
|
||||
inviewRegion = $( this ).attr( 'id' );
|
||||
@@ -156,8 +158,8 @@
|
||||
} );
|
||||
|
||||
var inview = $.uls.data.regiongroups[inviewRegion];
|
||||
$( 'div.uls-region' ).removeClass( 'active' );
|
||||
$( 'div#uls-region-' + inview ).addClass( 'active' );
|
||||
that.$element.find( 'div.uls-region' ).removeClass( 'active' );
|
||||
that.$element.find( 'div#uls-region-' + inview ).addClass( 'active' );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user