I can't really explain it, but responsive design has completely stopped working. The site is still in development, so we've been adding modules over that last week. Are there any modules that are known to cause issues with these theme?

Comments

yevgeny.ananin’s picture

Modules that I've added over the last few days:
editablefields, entity, link, entityreference, fb, twitter, oauth, features, job_scheduler, feeds.

I've disabled them all and still responsive design is no longer working. When I open the site in a mobile browser, I see the desktop layout - where it used to be all one column. I'm very puzzled.

yevgeny.ananin’s picture

Update

Well, one more weird thing is: if I reduce the size of the browser on my desktop to a small width (less than 480px), the responsive design does work as expected. However, the responsive design still doesn't work on any mobile browser that I check - I still get the desktop view where I have to pinch and zoom to see anything. Is there any reason it would stop working in mobile browsers but not in desktop browsers? Any help would be much appreciated.

yevgeny.ananin’s picture

Status: Active » Fixed

Ok, I figured it out. Apparently mobile browsers assume that the "viewport" (also called "virtual window") of a website is the same as a desktop browser, unless the site specifies a different viewport in the viewport meta tag. A responsive design site usually needs the following: <meta name="viewport" content="width=device-width" /> inside of the head tag.

To implement this in a theme, you can use:


<?php
function your_theme_preprocess_html(&$variables) {
  $meta_viewport = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'viewport',
      'content' => 'width=device-width'
    )
  );
  drupal_add_html_head($meta_viewport, 'viewport');
}
?>

I'm not sure if this was originally implemented in the theme, and maybe I broke it some how by fudging with the html.tpl.php and/or the page.tpl.php files. Regardless, the above code fixed my problem!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.