Authored by xuqi

del touch

... ... @@ -10,9 +10,11 @@ var $ = require('jquery'),
var chosePanel = require('./chose-panel');
var $curDelPanel;
//删除面板显示后任何点击行为都将触发隐藏面板
function docTouchEvt(e) {
$('.opt-panel:not(.hide)').addClass('hide');
function docTouchEvt() {
$curDelPanel && $curDelPanel.addClass('hide');
//
$(document).off('touchstart', docTouchEvt);
... ... @@ -51,7 +53,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
}).on('touchstart', '.icon-del', function(e) {
e.stopPropagation();
$(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');
//手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板
docTouchEvt();
$curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');
$(document).on('touchstart', docTouchEvt);
}).on('touchstart', '.opt-panel', function() {
... ...
... ... @@ -107,8 +107,9 @@
.opt-panel {
position: absolute;
width: 220rem / $pxConvertRem;
height: 190rem / $pxConvertRem;
right: 0;
top: 0;
bottom: 0;
color: #fff;
... ...
... ... @@ -134,9 +134,9 @@ class ShoppingCartController extends AbstractAction
public function tplAction()
{
if($this->isAjax()) {
//$data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml');
$data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml');
//echo($data);
echo($data);
}
}
... ...