[SOLVED]Switch css style & replace menu in the same position

Feel free to talk about everything related to our Joomla Products
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Thu Jan 12, 2012 9:44 am
Hi, I use The World News II but this is not important in my question.

We build website which looks differently in winter and in summer. This is easy because admin can set deafult style in gavern framework. Frontend user can switch from summer to winter easy with stylescheet switcher too.

The problem is we use one menu for winter and another for summer in the same position (top menu 1 in TWN II). Admin can change this. But, is there a way to set another menu to this postion when user switch the style from one to another?

I have an idea to put all the items (winter and summer) to one menu, add different classes to them and when user will change style, it add sth like "display:none" to several of them. But it's not the best solution...

So... can it be done in Joomla at all? Maybe there's a solution?

Thx for info.
User avatar
Fresh Boarder

teitbite
Thu Jan 12, 2012 9:45 pm
Hi

Style switching means that only CSS is dynamic, so using display:none is really a great idea here. But I would make it a little simplier and publish 2 menut at the same module position with different class suffixes and in style file disable showing of the unnecessary one.
User avatar
Moderator

GK User
Fri Jan 13, 2012 9:40 am
I made it this way - only 2 line of css code and it works perfect! :o Really simple.
Thank U a lot.

Style switcher sets the cookie to hold user with choosen style when he goes to another page. But When he close the browser window the cookie still hold the style for him.

How to set cookie only (for example) for few houers or 1 day or till he close the browser, so when he return he will see deafult style which is set by admin? Does this modification affect user who set "remember me" when he was log in?

Thx
User avatar
Fresh Boarder

GK User
Fri Jan 13, 2012 9:57 am
For changing cookie duration for frontend selected styles.

Find File: \templates\gk_template_name\js\gk.scripts.js
Find Function: changeStyle
Code: Select all
// Function to change styles
function changeStyle(style){
   var file1 = $GK_TMPL_URL+'/css/style'+style+'.css';
   var file2 = $GK_TMPL_URL+'/css/typography.style'+style+'.css';
   new Asset.css(file1);
   new Asset.css(file2);
   Cookie.write('gk1_style',style, { duration:365, path: '/' });
}

Change 365 days to 1 day ( duration:1 ),

See you around...
User avatar
Platinum Boarder

GK User
Fri Jan 13, 2012 1:16 pm
Nice, thank you!
User avatar
Fresh Boarder

teitbite
Fri Jan 13, 2012 6:41 pm
Hi

Exacly :)

Did You use style1.css and style2.css to hide menu and did You used one menu with each element's class or 2 menus? Sorry, I'm just curious :)
User avatar
Moderator

GK User
Sat Jan 14, 2012 9:21 am
Marking this topic as solved.

My guess would be :D
style 1 selected - renders menu1 class/suffix & menu2 class/suffix display:none
style 2 selected - renders menu2 class/suffix & menu1 class/suffix display:none

I believe how he is controlling/using menus & items is not included in 2 lines fix he has mentioned :D
Single php file in layout folder, 2 seperate menu codes with 2 seperate css class perhaps ?

See you around...
User avatar
Platinum Boarder

GK User
Sat Jan 14, 2012 9:23 am
I used two menu modules with diferent ul classes in one template position (top menu 1 in TWNII) and two css files. Everything works fine - layout holds everything in one place and menu items appears perfect in place. Nice :-)

Thank you one mor time!
User avatar
Fresh Boarder

teitbite
Sat Jan 14, 2012 10:38 pm
Hi

Ok. Glad I could help.
User avatar
Moderator


cron