Current User: Guest
Please consider registering

 
Search Forums:


 




Current or Selected Nav Item?

Post

ryanpaulyoung - Member

6:17 pm - August 2, 2011

posts 3

 
1

Post edited 10:18 pm - August 2, 2011 by ryanpaulyoung


AMAZING plugin, thanks so much. Has anyone been able to build a custom nav, where the current selected navigation item is highlighted? Hope that makes sense... just need to append a css class, but have NO idea how...

thanks for any insights... oh, and I will GLADLY make a donation, just let me know how much!

ryanpaulyoung - Member

2:53 pm - August 4, 2011

posts 3

 
2

Ok... well for anyone who's interested, this is how I solved my issue - paste this into your functions file and modify accordingly... there HAS to be an easier way, just one solution for the time being....

add_filter('awp_ajax_nav_actions', awp_compatible);
function awp_compatible($actions){
    $actions[] = 'var str = window.location.href;
                  var newCurrentNav = str.slice(35);
                  var oldSelectedNav = document.getElementById("menu").getElementsByTagName("div")[0].id;
                  var x=0;
                  var checkMe = "";
                  var myURLS = new Array("home","blog","news","tour","media","shop","discography","bio","contact","adhoc");
                  for (x=0;x<=10;x++){
                      checkMe = "#awp::"+myURLS[x];
                      if(str.indexOf(checkMe)!=-1){
                        document.getElementById(oldSelectedNav).setAttribute("id", newCurrentNav);
                      }
                   
                  }';
    return $actions;
    }

ryanpaulyoung - Member

3:02 pm - August 4, 2011

posts 3

 
3

Correction...

add_filter('awp_ajax_nav_actions', awp_compatible);
function awp_compatible($actions){
    $actions[] = 'var str = window.location.href;
                  var oldSelectedNav = document.getElementById("menu").getElementsByTagName("div")[0].id;
                  var x=0;
                  var checkMe = "";
                  var myURLS = new Array("home","blog","news","tour","media","shop","discography","bio","contact","adhoc");
                  for (x=0;x<=10;x++){
                      checkMe = "#awp::"+myURLS[x];
                      if(str.indexOf(checkMe)!=-1){
                        document.getElementById(oldSelectedNav).setAttribute("id", myURLS[x]);
                      }
                   
                  }';
    return $actions;
    }



Reply to Topic: Current or Selected Nav Item?

Name (Required):

EMail (Required):

Website):

Topic Reply:

HTML Editor
Save New PostSmileysOptions

Guest URL (required)

Math Required!
What is the sum of:
9 + 8
   

 
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell

 
 

About the Ajaxed WordPress forum

Most Users Ever Online:

35


Currently Online:

9 Guests

Forum Stats:

Groups: 1

Forums: 3

Topics: 186

Posts: 487

Membership:

There are 1163 Members

There have been 149 Guests

There is 1 Admin

There are 0 Moderators

Top Posters:

jakemc - 5

fromgrannie - 5

flash - 4

BAM - 4

Siam - 4

tombyrnes - 4

Administrators: Aaron (382 Posts)