Forum Moderators: open

Message Too Old, No Replies

Would really like help with location.href

location.href desn't seem to read past the extension

         

Sheynberg

3:55 am on Nov 30, 2007 (gmt 0)

10+ Year Member



I'm working on a vertical navigation menu, on a CMS driven site. I'd like to have the menu expand and collapse and am using jquery.accordion to do so.

The accordion script uses location.href to find out what section one is in, so that the other sections in the navbar can be collapsed. But, the content of the navbar (a definition list) is generated by the CMS, populated with links such as "index.php?=id=201". Apparently, location.href doesn't understand past the "index.php" part.

Any ideas on how to make the script understand what page I'm on? Any help would be greatly appreciated.

Excerpt below:


if ( settings.navigation ) {
var current = this.find("a").filter(function() { return this.href == location.href; });
if ( current.length ) {
if ( current.filter(settings.header).length ) {
settings.active = current;
} else {
settings.active = current.parent().parent().prev();
current.addClass("current");
}
}
}

[edited by: Sheynberg at 4:45 am (utc) on Nov. 30, 2007]

RonPK

8:55 am on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The
href
property of the
location
object always contains the complete URL, including query parameters. Period! There must be something else causing problems.