on/off switches for element classes

Permalink
Is there a away to add an enable/disable a class switch on an element? I would like to be able to add a switch in Page/Settings => Design => Customise to add or not add a 'sticky' class to the header and would like the client to decide whether they want a sticky header or not without having to edit the code. I'm sure with a bit of effort we could do this using styles.xml.

 
Steevb replied on at Permalink Reply
Steevb
You could try putting a ’fixed-header’ class in your css. Then client, in edit mode, clicks on header area and clicks ‘Edit Block’, then ‘Design & Custom Template’. Click in ‘Custom Class’ input box and type ‘fixed-header’ (no dot) and ’Save’.
jakobfuchs replied on at Permalink Reply
jakobfuchs
I don't think it's possible to do this in the style.xml file. The easiest way is probably to create a site wide attribute for this and add some PHP code to the header that toggles a CSS class on the page wrapper depending on the value of that attribute.