the page slide can't be closed when I click outside once. I have to click twice.
function onBodyClick(e) {
var target = e.touches && e.touches[0] || e.target;
if (
isOpen &&
body.contains(target) &&
!slider.contains(target)
) {
isOpen = false;
scope.psOpen = false;
scope.$apply();
}
when function onBodyClick() is called, isOpen is false, so the page slide can‘t be closed.
so, in function psOpen(), we need to insert code after scope.psOpen = true;
isOpen = true;
I change it, it works.
the page slide can't be closed when I click outside once. I have to click twice.
when function onBodyClick() is called, isOpen is false, so the page slide can‘t be closed. so, in function psOpen(), we need to insert code after scope.psOpen = true;
isOpen = true;
I change it, it works.