javascript style switcher not working

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
gtojulie

javascript style switcher not working

Post by gtojulie »

Hi,

Can I use a javascript style switcher? If so, any ideas why mine is not working? I added the script code to the template, have uploaded the javascript file and the two alternative style sheets but the site has now picked up the "largest text" style sheet so my text is now huge but doesn't switch when I press the buttons. The site is at www.mandyc.co.uk if you need to see what I mean.

Thanks very much for your help.

Mandy
cyberman

Re: javascript style switcher not working

Post by cyberman »

Cant see an alternate stylesheet in your page source like docu said
One main style sheet, many secondary ones. The script lets you maintain a primary style sheet on the page that is never disabled while letting the user choose from a list of alternate style sheets to add to the page. This lets you build off of your main style sheet with the alternate ones, so the later merely contain rules that are new or modified from the main one.

Code: Select all

<link rel="stylesheet" type="text/css" href="default.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="blue-theme" href="user.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="brown-theme" href="user2.css" />
gtojulie

Re: javascript style switcher not working

Post by gtojulie »

Hi,

Thanks. I know how to add alternative style sheets to an html page normally and I had the site running and the style switcher working before I put it into cms made simple. But with cms made simple style sheets are added to the template differently (with the add style sheet button) which I did and all three style sheets are listed in the system as belonging to that template. But I hadn't looked at the source code as you did and now see that only the main style sheet has been picked up and the alternatives haven't. So thanks for pointing that out. Question is now how do I get sms made simple to include the two alternative style sheets in my template?

Mandy
gtojulie

Re: javascript style switcher not working

Post by gtojulie »

I think I'm getting a little part of the way there thanks to cyberman. I have now added another two {stylesheet} holders to my html template but unfortunately all that does is pick up the same style sheet three times. Is there some code to use to pick up a different two?

Mandy
cyberman

Re: javascript style switcher not working

Post by cyberman »

You can use normal links to css like posted instead {stylesheet} tag.
gtojulie

Re: javascript style switcher not working

Post by gtojulie »

BINGO!!  ;D  THANK YOU VERY MUCH - IT WORKS!

I hadn't realised you could attach style sheets as normal.

Mandy
Pierre M.

Re: javascript style switcher not working

Post by Pierre M. »

BTW : your site doesn't use pretty URLs, not even internal ones. Think about it.
Pierre M.
Locked

Return to “CMSMS Core”