Second Navigation active selection
15 posts by 4 authors in: Forums > CMS Builder
Last Post: August 3, 2010 (RSS)
By dsternalski - July 11, 2010
I am trying to keep highlighted on the left the section of the site that the user is in.
I have got this to work, using the depth, however, this keeps all sections in the same depth when I'm trying to keep just the relevant depth highlighted.
Please find attached a screen shot as this is on a development server and also the code.
Re: [dsternalski] Second Navigation active selection
By Jason - July 12, 2010
So, in the screen shot you sent, you want to highlight "KS3", but not "KS2", is that right?
If so, instead of using the "depth" field, you can use the "_isSelected" field. With this you can detect which menu option has been selected, and then use css to highlight that element.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Second Navigation active selection
By dsternalski - July 12, 2010
This is working for the KS2 and KS3 but not for Subject List and options.
Please find code attached.
Re: [dsternalski] Second Navigation active selection
By Jason - July 12, 2010
There are a couple of issues with the code you're using:
<?php if($categoryRecord['_listItemStart'] and $categoryRecord['_isSelected']): ?>
<span class="secondNavCurrentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></span>
<?php if($categoryRecord['_isSelected']): ?>
<span class="depthOne"></span>
<?php elseif($categoryRecord['_isSelected']): ?>
<span class="depthTwo"></span>
<?php elseif($categoryRecord['_isSelected']): ?>
<span class="depthThree"></span>
<?php endif ?>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
At the top of your "if" statement, your checking to see if the variable _isSelected is true. If it is, you're executing the if statements below. These if statements are actually just checking the same thing 3 more times. Since it will always have to be true, the first one will always execute and print out <span class="depthOne"></span>. This doesn't seem to be doing anything, so we can take it out.
Try this code:
<?php if($categoryRecord['_listItemStart'] and $categoryRecord['_isSelected']): ?>
<span class="secondNavCurrentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></span>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
If this doesn't work for you, could you please send me a link to your page so I can see the script in action?
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Second Navigation active selection
By dsternalski - July 17, 2010 - edited: July 17, 2010
The second navigation now needs to be like an accordion like: http://www.i-marco.nl/weblog/jquery-accordion-menu/.
However, when I try and add this into the php, it doesn't work. Are you able to put me in the right direction?
Re: [dsternalski] Second Navigation active selection
By Donna - July 19, 2010
Can you let me know what you have so far?
--
support@interactivetools.com
Re: [Donna] Second Navigation active selection
By dsternalski - July 20, 2010
please find attached the navigation file, and the associated css and js files.
Re: [dsternalski] Second Navigation active selection
By Jason - July 21, 2010
Could you please send a link to this page on your server so i can see what it's doing?
Thanks.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Second Navigation active selection
By dsternalski - July 23, 2010
This site is on my dev server at the moment. I'm hoping to get it up onto a live test server next week.
I have attached two html files, DevJqueryNav.html is the source code that is generated when I try to add the jquery accordion into my navigation and liveJqueryNav.html is a live sample of the jquery and how it should be working.
I have marked out in the code where the jquery nav starts and ends.
Re: [dsternalski] Second Navigation active selection
By Jason - July 27, 2010
I took a look at your files. What I think is happening is that for your <ul> tag, you're using this:
<ul class="adxm menu">
What you're probably getting is just an unordered list on your page. This is because the accordion script is looking for a <ul> tag with an id of menu:
<ul id="menu">
Since it's not find it, nothing happens. Try that and see if it fixes it.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/