问题出在我正在开发的网站上
http://balticpremier.sem.lv/en/
滚动到底部,请参阅“我们提供的产品”部分。它应该在悬停并单击时扩展,在PC上不会出现问题。但是,通过电话对其进行单击时,它会产生淡入淡出效果,并且逻辑不正确。
这是影响这部分的唯一JS,在这里:
$('.deliveredCategory').on('click mouseenter mouseleave', function () {
$(this).find(".expandableClient").toggle();
$(this).find('.plus-minus-toggle').toggleClass('collapsed');
$(this).find('.dotHide').toggle();
});
帮助赞赏!
编辑:忘记说淡入淡出效果不是代码的一部分,仅发生在移动设备上。这是怎么toggle(); 是在手机上解释的吗?无论哪种方式,在移动设备上扩展后,我都无法将其关闭。真的很奇怪。
好的,找到解决方案。我真的希望它能满足yopu的要求,如果不能,那就对不起:)
因此,您可以检查该设备是否为触摸设备,如果是,则取消绑定鼠标悬停事件。或您想要的任何其他事件。
var num = 0;
$(".testDiv").on("click mouseover", function() {
num++;
$(".testDiv").text(num)
});
if (!!('ontouchstart' in window)) { //check for touch device
$('.cc').unbind('mouseover');
}
.testDiv {
background: lightgreen;
overflow: hidden;
height: 200px;
color: #fff;
font-size: 40px;
font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span>Div below uses "click mouseover"</span>
<div class="testDiv">
<p>
Initial text to test whether hovering this works properly. Initial text to test whether hovering this works properly.
</p>
</div>
希望这就是您想要的。
问候,KJ
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句