Style switcher.

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

StuartF
Ebase User
Posts: 14
Joined: Thu Sep 26, 2013 11:35 am

Style switcher.

#1

Postby StuartF » Thu Oct 31, 2013 4:10 pm

Hi, we are giving a demo of a responsive form that uses a presentation template linked to a web resource style sheet, that in turn gets it classes from an external css.

We would like to have some buttons in the demo where we could switch the external style sheet to and show a different look.

Is it possible to change the link to the external css from a button script.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Oct 31, 2013 5:30 pm

You could always change the template - this will work if you're loading the style sheets by linking them to the template (under Web Resources). Then you can load a different style sheet or a different combination of style sheets e.g. your second style sheet could just redefine the CSS rules you want to change - this relies on the CSS precedence rule that says that the last loaded definition wins.

Code: Select all

form.setPresentationTemplateName("TEMPLATE2");      //Javascript
set template TEMPLATE2;                           // FPL
Otherwise the answer depends on how you're styling the button in the style sheet. The only things you can change dynamically from a script are class and inline style - you can't change the style sheet (except by changing the template).
Last edited by Jon on Fri Nov 01, 2013 8:08 am, edited 1 time in total.
0 x

StuartF
Ebase User
Posts: 14
Joined: Thu Sep 26, 2013 11:35 am

#3

Postby StuartF » Fri Nov 01, 2013 7:59 am

Cheers, that looks like the best approach.
0 x


Who is online

Users browsing this forum: No registered users and 12 guests