【问题标题】:How to make the Opencart mini cart close when touched by iPhone/iPad useriPhone/iPad 用户触摸时如何关闭 Opencart 迷你购物车
【发布时间】:2013-06-27 19:44:30
【问题描述】:

我正在为 opencart 制作一个响应式主题。在 iPhone 视图中,我可以单击购物车,然后下拉内容并显示购物车中的内容。我遇到的问题是我无法让推车再次关闭,因此它保持打开状态并挡住了路。

我设法通过将“mouseleave”更改为“click”来使其工作,但它只能工作一次,然后我必须刷新页面才能使其再次工作。我相信这对某人来说非常简单。

这里是代码;

/* Ajax Cart */
$('#cart > .heading a').live('click', function() {
    $('#cart').addClass('active');

    $('#cart').load('index.php?route=module/cart #cart > *');

    $('#cart').live('mouseleave', function() {
        $(this).removeClass('active');

    });
});

有什么想法吗?

提前致谢。

【问题讨论】:

    标签: opencart


    【解决方案1】:

    我在您粘贴的 common.js 代码上方的代码行中添加了一些内容来解决此问题。

    $('html').on('touchend.tap', function(){
      if ($('#cart').hasClass('active')){
        $('#cart').removeClass('active')
      }
     });
    
    $('div#cart').on('touchend.tap', function(e){
      e.stopPropagation();
    });
    

    这允许链接在迷你购物车中发挥作用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-21
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多