Mobile menu breakpoint in Magento 2
How do you change the breakpoint at which mobile menu appears in Magento 2?
magento2 menu
add a comment |
How do you change the breakpoint at which mobile menu appears in Magento 2?
magento2 menu
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41
add a comment |
How do you change the breakpoint at which mobile menu appears in Magento 2?
magento2 menu
How do you change the breakpoint at which mobile menu appears in Magento 2?
magento2 menu
magento2 menu
asked Nov 1 '16 at 12:42
DevtypeDevtype
2,09911231
2,09911231
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41
add a comment |
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41
add a comment |
3 Answers
3
active
oldest
votes
You have to replace style in webcsssource _navigation.less in your custom theme.
For Desktop
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
to (your custom width)
@media only screen and (min-width: 1024px) {
And for Mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
to (your custom width)
@media only screen and (max-width: 1023px) {
Remember one thing you have to add max-width is -1 from min-width.
add a comment |
The JS for the menu that has that functionality can be found in
lib/web/mage/menu.js
First create the folder structure in your theme ex:
[Namespace]/[theme_name]/web/mage/
And copy menu.js from lib/web/mage/menu.js to [Namespace]/[theme_name]/web/mage/menu.js
And change
mediaBreakpoint: '(max-width: 768px)'
to
mediaBreakpoint: '(max-width: 1025px)'
And copy css from mobile and write specific brakpoint
add a comment |
Another approach is to overide the value in your theme of the @screen__m LESS variable. But this will not only change the mobile breakpoint for the navigation, it will change the mobile breakpoint everywhere.
Add to your theme's _extend.less
@screen__m: 960px;
Also, for best performace results you should add the following file to your theme
Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/styles-l.css" media="screen and (min-width: 960px)"/>
</head>
</page>
For more info see:
https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/responsive-web-design/rwd_css.html
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f143519%2fmobile-menu-breakpoint-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have to replace style in webcsssource _navigation.less in your custom theme.
For Desktop
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
to (your custom width)
@media only screen and (min-width: 1024px) {
And for Mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
to (your custom width)
@media only screen and (max-width: 1023px) {
Remember one thing you have to add max-width is -1 from min-width.
add a comment |
You have to replace style in webcsssource _navigation.less in your custom theme.
For Desktop
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
to (your custom width)
@media only screen and (min-width: 1024px) {
And for Mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
to (your custom width)
@media only screen and (max-width: 1023px) {
Remember one thing you have to add max-width is -1 from min-width.
add a comment |
You have to replace style in webcsssource _navigation.less in your custom theme.
For Desktop
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
to (your custom width)
@media only screen and (min-width: 1024px) {
And for Mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
to (your custom width)
@media only screen and (max-width: 1023px) {
Remember one thing you have to add max-width is -1 from min-width.
You have to replace style in webcsssource _navigation.less in your custom theme.
For Desktop
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
to (your custom width)
@media only screen and (min-width: 1024px) {
And for Mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
to (your custom width)
@media only screen and (max-width: 1023px) {
Remember one thing you have to add max-width is -1 from min-width.
answered Dec 14 '16 at 9:04
Dipesh RanganiDipesh Rangani
1,8012931
1,8012931
add a comment |
add a comment |
The JS for the menu that has that functionality can be found in
lib/web/mage/menu.js
First create the folder structure in your theme ex:
[Namespace]/[theme_name]/web/mage/
And copy menu.js from lib/web/mage/menu.js to [Namespace]/[theme_name]/web/mage/menu.js
And change
mediaBreakpoint: '(max-width: 768px)'
to
mediaBreakpoint: '(max-width: 1025px)'
And copy css from mobile and write specific brakpoint
add a comment |
The JS for the menu that has that functionality can be found in
lib/web/mage/menu.js
First create the folder structure in your theme ex:
[Namespace]/[theme_name]/web/mage/
And copy menu.js from lib/web/mage/menu.js to [Namespace]/[theme_name]/web/mage/menu.js
And change
mediaBreakpoint: '(max-width: 768px)'
to
mediaBreakpoint: '(max-width: 1025px)'
And copy css from mobile and write specific brakpoint
add a comment |
The JS for the menu that has that functionality can be found in
lib/web/mage/menu.js
First create the folder structure in your theme ex:
[Namespace]/[theme_name]/web/mage/
And copy menu.js from lib/web/mage/menu.js to [Namespace]/[theme_name]/web/mage/menu.js
And change
mediaBreakpoint: '(max-width: 768px)'
to
mediaBreakpoint: '(max-width: 1025px)'
And copy css from mobile and write specific brakpoint
The JS for the menu that has that functionality can be found in
lib/web/mage/menu.js
First create the folder structure in your theme ex:
[Namespace]/[theme_name]/web/mage/
And copy menu.js from lib/web/mage/menu.js to [Namespace]/[theme_name]/web/mage/menu.js
And change
mediaBreakpoint: '(max-width: 768px)'
to
mediaBreakpoint: '(max-width: 1025px)'
And copy css from mobile and write specific brakpoint
edited Mar 30 '18 at 12:35
Piyush
4,78872053
4,78872053
answered Mar 30 '18 at 12:25
MHK DeveloperMHK Developer
9916
9916
add a comment |
add a comment |
Another approach is to overide the value in your theme of the @screen__m LESS variable. But this will not only change the mobile breakpoint for the navigation, it will change the mobile breakpoint everywhere.
Add to your theme's _extend.less
@screen__m: 960px;
Also, for best performace results you should add the following file to your theme
Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/styles-l.css" media="screen and (min-width: 960px)"/>
</head>
</page>
For more info see:
https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/responsive-web-design/rwd_css.html
add a comment |
Another approach is to overide the value in your theme of the @screen__m LESS variable. But this will not only change the mobile breakpoint for the navigation, it will change the mobile breakpoint everywhere.
Add to your theme's _extend.less
@screen__m: 960px;
Also, for best performace results you should add the following file to your theme
Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/styles-l.css" media="screen and (min-width: 960px)"/>
</head>
</page>
For more info see:
https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/responsive-web-design/rwd_css.html
add a comment |
Another approach is to overide the value in your theme of the @screen__m LESS variable. But this will not only change the mobile breakpoint for the navigation, it will change the mobile breakpoint everywhere.
Add to your theme's _extend.less
@screen__m: 960px;
Also, for best performace results you should add the following file to your theme
Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/styles-l.css" media="screen and (min-width: 960px)"/>
</head>
</page>
For more info see:
https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/responsive-web-design/rwd_css.html
Another approach is to overide the value in your theme of the @screen__m LESS variable. But this will not only change the mobile breakpoint for the navigation, it will change the mobile breakpoint everywhere.
Add to your theme's _extend.less
@screen__m: 960px;
Also, for best performace results you should add the following file to your theme
Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/styles-l.css" media="screen and (min-width: 960px)"/>
</head>
</page>
For more info see:
https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/responsive-web-design/rwd_css.html
edited Jan 15 at 13:55
answered Jan 15 at 13:25
HollyHolly
2,24233371
2,24233371
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f143519%2fmobile-menu-breakpoint-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this link may help.
– Milan Chandro
Jun 6 '18 at 10:41