简体   繁体   English

移动屏幕上的菜单按钮不可点击 wordpress 店面主题

[英]menu button on mobile screen is not clickable wordpress storefront theme

I am having a trouble in my wordpress ecommerce store and I am not able to trace out the bug.我在我的 wordpress 电子商务商店遇到了问题,我无法找出错误。

My wordpress website has a menu on top and it is working fine in web browser, but when I am Opening in mobile screen it becomes a Menu Button, which is not clickable .Please someone help me to make it clickable in order to show dropdown menu items.我的 wordpress 网站顶部有一个菜单,它在网络浏览器中工作正常,但是当我在移动屏幕中打开时,它变成了一个菜单按钮,不可点击。请有人帮助我使其可点击以显示下拉菜单项目。

Wordpress Theme: Storefront WordPress 主题:店面

website Link: https://www.nuttynuts.pk/网站链接: https : //www.nuttynuts.pk/

If I look at your code, the mobile menu with the class of handheld-navigation does have the in the CSS a max-height: 0 .如果我查看您的代码,带有handheld-navigation类的移动菜单确实在 CSS 中有一个max-height: 0 Clicking the button does not change this, so you are missing the javascript function to handle this.单击按钮不会改变这一点,因此您缺少处理此问题的 javascript 函数。 You can do it by toggling a class.您可以通过切换类来实现。

In your css file, add a class and give it the max-height:在您的 css 文件中,添加一个类并为其指定 max-height:

.my_custom_class { max-height: auto !important; }

And with javascript (using jquery), you toggle this class on click on the button:使用 javascript(使用 jquery),您可以在单击按钮时切换此类:

( function( $ ) {
    $(document).ready(function () {
      $(".menu-toggle").click(function (e) {
        e.preventDefault();
        $(".handheld-navigation").toggleClass("my_custom_class ");
      });
    });
}( jQuery ) );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM