Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(offCanvas): add closeOnClick attribute to prevent hiding #102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat(offCanvas): add closeOnClick attribute to prevent hiding #102

wants to merge 2 commits into from

Conversation

dmglab
Copy link

@dmglab dmglab commented Sep 1, 2014

This adds support to prevent hiding the offcanvas with close-on-click="false"

zurb's jquery offcanvas has a familiar behavior.

@mikeatlas
Copy link

+1 please!

@mikeatlas
Copy link

For some reason, Chrome on Android would trigger the offCanvasWrap version of the hide method when focusing in on my sidebar, whereas on a desktop, the focused element click event would fire on the offCanvasList. So, anyways, I had to also change:

.directive('offCanvasWrap', ['$window', function ($window) {
        return {
            scope: { closeOnClick: "=" },
            restrict: 'C',
            link: function ($scope, element, attrs) {
                var win = angular.element($window);
                var sidebar = $scope.sidebar = element;

                $scope.hide = function () {
                    if ($scope.closeOnClick !== false) {
                      sidebar.removeClass('move-left');
                      sidebar.removeClass('move-right');
                    }
                };

                win.bind("resize.body", $scope.hide);

                $scope.$on('$destroy', function() {
                    win.unbind("resize.body", $scope.hide);
                });

            },
   // ...

@eyafaer
Copy link

eyafaer commented Aug 12, 2015

Updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants