Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responsive Design: Allow user to also view Full Site

When using responsive design, is there a way to still allow a user to view the full site?

E.g. They are viewing on an iPhone, but want to see the full site. They click a "Full Site" link, and it shows them the 1024px version.

like image 975
Nic Hubbard Avatar asked Apr 11 '12 19:04

Nic Hubbard


People also ask

What happens when a site has a responsive web design?

A responsive web design automatically adjusts for different-sized screens and viewports. With a responsive website, someone can browse your website from any device and it will still look and function perfectly.

What are the 3 basic things required for responsive web design?

The 3 Major Principles of Responsive DesignFluid Grid Systems. Fluid Image Use. Media Queries.

What is fully responsive design?

Responsive design is an approach to web page creation that makes use of flexible layouts, flexible images and cascading style sheet media queries. The goal of responsive design is to build web pages that detect the visitor's screen size and orientation and change the layout accordingly.


2 Answers

If you're using media queries, only apply rules beneath a body element having the class 'responsive'.

@media screen and (max-width: 320px) {
  body.responsive {
    color: blue;
  }
}

If the user doesn't want to view the responsive layout, simply remove the 'responsive' class from the body element, nullifying all rules. You could persist the users preference by cookie or some other method as well.

Demo: http://jsbin.com/obaquq/edit#javascript,html

Reducing the window to no more than 500px will turn the text white, and the background blue. This is conditional on the body having the 'responsive' class. Clicking the first paragraph will toggle this class, and thus toggle the effects of the media query itself.

like image 153
Sampson Avatar answered Nov 12 '22 16:11

Sampson


I've been wondering about this. I had success using jQuery to modify the viewport tag, seems to work fairly well from what I can tell so far. Doesn't require multiple stylesheets or a lot of extra CSS.

http://creativeandcode.com/responsive-view-full-site/

like image 39
Chris Morata Avatar answered Nov 12 '22 14:11

Chris Morata