this.find("a").filter(function() in jQ Treeview: Please, help to modify
jQuery Treeview menu in "location" mode, open menu section that matches the url :
...
<ul class="filetree">
<li><a href="/catalog/motherboards">Motherboards</a></li>
...
2 |
var current = this .find( "a" ).filter( function () { return this .href.toLowerCase() == location.href.toLowerCase(); }); |
3 |
if ( current.length ) { |
4 |
current.addClass( "selected" ).parents( "ul, li" ).add( current.next() ).show(); |
I need to change condition in .
filter(
function
() ) that it was not strict equality (==), I need that this function find ANY matches of substring-url, for example:
domain.com/catalog/motherboards/
asus-101
domain.com/catalog/motherboards/s1151/asus-105/1
If I click any of this links main section "
domain.com/
catalog/motherboards" OR
"
domain.com/
catalog/motherboards/s1151"
must be still open,
regardless of the selected product.
I try change "==" to IndexOf, but
unsuccessfully...
P.S......
Before that, I used php variables in the address, for ex: catalog.php?type=motherboards&socket=1155&label=Asus-101
I had a cheat with regexp, so any text after "&l=..." was ignored:
- var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase().replace(/&l.*/, ""); });
But now I use "simple" (SEF) URLs and I dont have any unique marker to use regexp (