fixed cross browser compatibility issue

This commit is contained in:
tworrall 2012-05-10 13:38:08 +00:00
parent 43db4d7416
commit 39590ec936

View file

@ -48,12 +48,15 @@ var browseByVClass = {
return false; return false;
}); });
// save the selected vclass in location hash so we can reset the selection
// if the user navigates with the back button
this.browseVClasses.children('li').each( function() { this.browseVClasses.children('li').each( function() {
$(this).find('a').click(function () { $(this).find('a').click(function () {
// the extra space is needed to prevent odd scrolling behavior // the extra space is needed to prevent odd scrolling behavior
location.hash = $(this).attr('data-uri') + ' '; location.hash = $(this).attr('data-uri') + ' ';
}); });
}); });
// Call the pagination listener // Call the pagination listener
this.paginationListener(); this.paginationListener();
}, },
@ -73,7 +76,9 @@ var browseByVClass = {
defaultVClass: function() { defaultVClass: function() {
if ( this.defaultBrowseVClassURI != "false" ) { if ( this.defaultBrowseVClassURI != "false" ) {
if ( location.hash ) { if ( location.hash ) {
this.getIndividuals(location.hash.substring(1,location.hash.length - 1), "all", 1, false); // remove the trailing white space
location.hash = location.hash.replace(/\s+/g, '');
this.getIndividuals(location.hash.substring(1,location.hash.length), "all", 1, false);
} }
else { else {
this.getIndividuals(this.defaultBrowseVClassUri, "all", 1, false); this.getIndividuals(this.defaultBrowseVClassUri, "all", 1, false);