danielepiccone / ng-pageslide

AngularJS sliding panel for serving additional content from off the page
http://danielepiccone.github.io/ng-pageslide/examples/
452 stars 162 forks source link

There is a bug when click outside #176

Open yuzhigang opened 6 years ago

yuzhigang commented 6 years ago

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.