#2912 - Hybrid responsive theme

Identifier #2912
Issue type Feature request or suggestion
Title Hybrid responsive theme
Status Completed
Tags

Risk: Breaks themes (custom)

Handling member Chris Graham
Addon core_themeing
Description The current theme uses separate mobile/desktop modes, with a small amount of responsive design for tablets running on desktop mode.

We can fairly easily make a hybrid mode, whereby responsive design is used in addition to the separate mobile/desktop modes.

We can do it via a new Tempcode directive that outputs full media rules on desktop mode, while compiling simplified (low bandwidth) rules on mobile mode.

Instead of something like this:

.foo {
{+START,IF,{$MOBILE}}
width: 100%;
{+END}
{+START,IF,{$NOT,{$MOBILE}}}
width: 600px;
{+END}
}

We'd do:

{+START,MODE,mobile}
.foo {
width: 100%;
}
{+END}
{+START,MODE,desktop}
.foo {
width:600px;
}
{+END}

On mobile mode this would compile to...

.foo {
width: 100%;
}

On desktop mode this would compile to something like...

@media screen and (min-device-width: 320px) and (max-device-width: 640px) {
.foo {
width: 100%;
}
}
@media screen and (min-device-width: 641px) {
.foo {
width:600px;
}
}

Somewhere we would define what the pixel ranges of the mobile and desktop modes are.

The advantage of this is it keeps the default theme pretty simple, while allowing a nice response theme for desktop, and an optimised theme for mobile. It actually makes the responsive coding simpler, as you don't have to keep copy-and-pasting the device widths, and I think it looks cleaner.
You could still use media rules to get greater specificity.
Steps to reproduce

Related to

#2095 - Bootstrap theme

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated