Storefront: switch to mobile layout for 768px-wide screens

房东的猫 提交于 2019-12-14 02:28:45

问题


I am developping a child theme of Woocommerce Storefront.

On a tablet (portrait, 768px wide), I would like the "mobile" layout (burger menu, etc) to be displayed, instead of the the desktop layout (main-menu, etc).

I used the following css media queries: @media (max-width: 768px) for mobile @media (min-width: 769px) for desktop in my css file.

But all the media queries of storefront seem to activated desktop layout for @media (min-width: 768px).

How can I change this breakpoint?

EDIT 1: I tried to edit the file wp-content/themes/storefront/assets/sass/utils/_variables.scss to

$desktop:           769px;
$handheld:          768px;

but it doesn't change the layout.

EDIT 2: I tried this in the functions.php

// Change Woocommerce css breaktpoint from max width: 768px to 767px  
add_filter('woocommerce_style_smallscreen_breakpoint','woo_custom_breakpoint');
function woo_custom_breakpoint($px) {
  $px = '769px';
  return $px;
}

but it doesn't work either.


回答1:


I changed the breakpoint value in /storefront/assets/sass/utils/_variables.scss and recompile all Storefront files (including sass files) using the grunt file in storefront. Just run $ grunt.



来源:https://stackoverflow.com/questions/46603787/storefront-switch-to-mobile-layout-for-768px-wide-screens

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!