PDA

View Full Version : Style Sheet Switcher with iFrames



SteveToms
11-30-2013, 12:36 AM
1) Script Title: Style Sheet Switcher (v1.1)

2) Script URL (on DD):
3) Describe problem: I am using iFrames, and when I select a theme. It doesn't load it for the complete page. If you refresh, it loads the selected theme.

Beverleyh
11-30-2013, 05:46 PM
Firstly, your website is impossible to navigate on iPhone - hugely large and doesn't shrink to fit the viewport. It also keeps crashing when I try to change your switcher. This is another matter entirely but it means that I can only really make suggestions for your queried problem.

I imagine the frames are what is causing the 'half-switch' - the stylesheet immediately changes in the document where the select options are located, but until there is a refresh, the cookie cannot apply the change to the other framed documents that make up your site 'page'. A workaround for this could be to add a refresh option into the select menu for the style switcher - to force a page refresh on theme selection.

A reload could be as simple as this;
<select onchange="location.reload()">

I haven't tested but here are two examples for reference;

http://stackoverflow.com/questions/17699316/how-to-reload-same-page-after-change-the-select-box-option

http://stackoverflow.com/questions/10940840/reload-page-on-select

SteveToms
12-01-2013, 02:29 AM
Firstly, your website is impossible to navigate on iPhone - hugely large and doesn't shrink to fit the viewport. It also keeps crashing when I try to change your switcher. This is another matter entirely but it means that I can only really make suggestions for your queried problem.

I imagine the frames are what is causing the 'half-switch' - the stylesheet immediately changes in the document where the select options are located, but until there is a refresh, the cookie cannot apply the change to the other framed documents that make up your site 'page'. A workaround for this could be to add a refresh option into the select menu for the style switcher - to force a page refresh on theme selection.

A reload could be as simple as this;
<select onchange="location.reload()">

I haven't tested but here are two examples for reference;

http://stackoverflow.com/questions/17699316/how-to-reload-same-page-after-change-the-select-box-option

http://stackoverflow.com/questions/10940840/reload-page-on-select


It works, thank you. I changed it back to test some other stuff. New problem, it won't remember the chosen style. At least not in the drop down menu.