Set on state manually using CSS Menus Action

Is it possible to set an on state manually when creating a menu using the CSS Menus Action?

I have a main page “Products” with subpages for products. “Products” has 3 subpages (for example), “A”, “B”, and “C”. These are accessed via a subnavigation menu, also using CSS Actions.

When I go to “A” (which is no longer the Products page), I would like to have the Products main nav item still highlighted. Can I do this, and if so how?

Thanks.

Richard.
(a Freeway old timer who hasn’t used FW in a while…)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Could you post a link to an example page somewhere? There’s a trick I use all the time in JavaScript to do this, but I need to see what classnames Freeway is using to indicate the current page in order to show you how it works.

Walter

On Jun 12, 2013, at 11:46 AM, Richard Cacciato wrote:

Is it possible to set an on state manually when creating a menu using the CSS Menus Action?

I have a main page “Products” with subpages for products. “Products” has 3 subpages (for example), “A”, “B”, and “C”. These are accessed via a subnavigation menu, also using CSS Actions.

When I go to “A” (which is no longer the Products page), I would like to have the Products main nav item still highlighted. Can I do this, and if so how?

Thanks.

Richard.
(a Freeway old timer who hasn’t used FW in a while…)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter!

I’ve put sample pages here:
http://www.blue-iceberg.net/freeway/cssmenusample/

I want Products in the main nav to stay in the on state when you go from this page:
http://www.blue-iceberg.net/freeway/cssmenusample/products.html

to this page

http://www.blue-iceberg.net/freeway/cssmenusample/a.html

since A is a subpage of Products.

Thanks in advance.

Richard.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

My trick relies on the menu and the pages following a common directory structure. So if in your menu you had

Products
	Salsa
	Oven Mitts

you would have the following directory structure to go with:

products/
	index.html
	oven_mitts.html
	salsa.html

Then, the trick is to simply traverse the URL of the current page and see if you can find a match to the parent.

So it’s not going to work on your example, because you haven’t reflected the site structure in your menu. But if you make a products folder and have an index.html in it instead of the current products.html, and then put your product_a.html and product_b.html in that folder as well, then it’s pretty simple to do (with Protaculous2):

matches = 0;
$$('#fwNav1 a').each(function(link){
  if(link.readAttribute('href') == window.location.pathname){
    link.addClassName('fwCurrent');
    matches++;
  }
});
if(matches < 1){
  $$('#fwNav1 a').select(function(elm){
    var link = elm.readAttribute('href');
    if(link) link = link.split('?').first();
    if(link && link.length > 1){
      return window.location.pathname.match(
        new RegExp(link)
      );
    }
  }).invoke('addClassName', 'fwCurrent');
}

In experimenting with this, it appeared to me as though Highlight Current Page was actually doing what you want on the child pages, can’t be sure though. You should experiment with simply making the structure of the folder the way I describe, and enabling that feature on the main menu options, and see if it does do this without the added JavaScript. Otherwise, this will do the trick. Note carefully that I am relying on there being a single menu on your page, which gets named fwNav1. That number increments with each nav on the same page, so you would want to adjust your code to reflect the one you need to highlight.

Walter

On Jun 12, 2013, at 1:37 PM, Richard Cacciato wrote:

Hi Walter!

I’ve put sample pages here:
http://www.blue-iceberg.net/freeway/cssmenusample/

I want Products in the main nav to stay in the on state when you go from this page:
http://www.blue-iceberg.net/freeway/cssmenusample/products.html

to this page

http://www.blue-iceberg.net/freeway/cssmenusample/a.html

since A is a subpage of Products.

Thanks in advance.

Richard.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 2013-06-12, at 19:37 , Richard Cacciato email@hidden wrote:

I’ve put sample pages here:

Hi Richard,

The submenu in one row only is nice!

What do I have to use if I want to replicate this kind of navigation?

Actions?

Scripts?

Or maybe much more basic?

/

with best regards,
Omar K N
(Stockholm, Sweden)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options