m.dominio.com
m.dominio.com
ETHAN MARCOTTE
A List Apart, 2010
@media all and (min-width: 320px) { .col { background-color: green } .co2 { background-color: blue} .co3 { background-color: red} } @media all and (min-width: 768px) { .col1 { float: left; width: 50% } .col2 { float: left; width: 50% } .col3 { clear:both } }
function theme_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }
function theme_menu_tree($variables) { return '<ul class="menu">' . $variables['tree'] . '</ul>'; }
Drupal.behaviors.rwdmenu = { attach: function(context, settings) { function RWDMenu(){ if (($(this).width() < 768) && ($('#main-menu .show-menu').length == 0)) { $('#main-menu').prepend('<a href="javascript:;" class="show-menu" title="'+ Drupal.t('Show menu')+'">Menu</a>'); $('#main-menu ul').addClass("hide"); $('#main-menu a.show-menu', context).click(function() { $('#main-menu ul').toggleClass('hide show'); }); } else if (($(this).width() > 768) && ($('#main-menu .show-menu').length != 0)) { $('#main-menu .show-menu').remove(); $('#main-menu ul').removeClass('hide'); } } $(window).bind('resize orientationchange', function() { RWDMenu(); }); RWDMenu(); } }; })(jQuery, Drupal, this, this.document);
<div class="field-item even" rel="og:image rdfs:seeAlso" resource="teaser_mb.png"> <span data-picture=""> <span data-src="teaser_mb.png" data-width="600" data-height="400"></span> <span data-media="(min-width: 0px) and (max-width: 49.99em)" data-src="teaser_mb.png" data-width="600" data-height="400"></span> <span data-media="(min-width: 50em) and (max-width: 61.19em)" data-src="teaser_narrow.png" data-width="1000" data-height="500"></span> <span data-media="(min-width: 61.2em)" data-src="teaser_desktop.png" data-width="1000" data-height="200"></span> <noscript> <img typeof="foaf:Image" src="teaser_mb.png" width="600" height="400" alt="" /> </noscript> </span> </div>
Opción compleja muy configurable, todavía en dev
Nos permiten definir y cambiar de layout «fácilmente»
(sin float, clear, overflow ...) en función de la mediquery (SASS&CSS)
Ejemplo gemfile
source "https://rubygems.org" # Working stack for Zen, from https://drupal.org/node/2188263#comment-8567655 gem "sass", "3.2.14" gem "compass", "0.12.3" gem "zen-grids", "1.4" gem "breakpoint", "2.0.7" gem "susy", "2.0.0.alpha.4" gem "sass-globbing" gem "sassy-buttons"
$ gem install bundler $ bundle install
<div class="sidebar-first"> <div id="content"> Contenido </div> <div class="region-sidebar-first"> Columna </div> </div>
$zen-column-count: 3; $zen-gutter-width: 20px; .sidebar-first { .region-sidebar-first { @include zen-grid-item(1, 1); } #content { @include zen-grid-item(2, 2); } }
.has-two-sidebars { .l-content { @include span-columns(8, 16); @include push(4, 16); } .l-region--sidebar-first, .l-region--sidebar-second { @include span-columns(4, 16); } .l-region--sidebar-first { @include pull(12, 16); } .l-region--sidebar-second { @include omega; clear: none; } }
<div class="has-two-rightsidebars"> <div class="l-content"> Contenido </div> <div class="l-region--sidebar-first"> Columna 1 </div> <div class="l-region--sidebar-second"> Columna 1 </div> </div>
.has-two-rightsidebars { .l-content { @include span-columns(8, 12); } .l-region--sidebar-first, .l-region--sidebar-second { @include span-columns(4 omega, 12); } .l-region--sidebar-second { clear: right; } }
Cristina Chumillas. Drupal Designer and Themer at Ymbra
@chumillas
Pako Garcia. Veggie Drupal Themer and Designer at Ymbra
@pakmanlh