Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

hold functions are not working properly on mixed events #13

Open
feyyazakkus opened this issue Jun 8, 2016 · 1 comment
Open

hold functions are not working properly on mixed events #13

feyyazakkus opened this issue Jun 8, 2016 · 1 comment

Comments

@feyyazakkus
Copy link

feyyazakkus commented Jun 8, 2016

I have a directive which creates buttons for scroll up and down events. I used this directive plugin in my own directive's templates. When i mixed hold and secure-tap events sometimes hold functions are not working. I really dont know why. But secure-tab functions always working.

And if i use only tab events its also working as its supposed to be.

I am testing this in chrome with some mobile window extention.

Here is my directive:

  app.directive('scrollUpDown', function () {

      var scrolled = 0, docHeight;

      return {
        restrict: 'EA',
        template: '<div class="scroll-up-down-buttons" ng-show="display">' +
            '<p><span mn-touch secure-tap="tapUp()" threshold="30" hold="holdUp()" holdfor="600" class="glyphicon glyphicon-circle-arrow-up"></span></p>' +
            '<p><span mn-touch secure-tap="tapDown()" threshold="30" hold="holdDown()" holdfor="600" class="glyphicon glyphicon-circle-arrow-down"></span></p>' +
        '</div>',

        link: function (scope, element, attrs) {

          // if mobile device
          scope.display = ($(window).width() <= 768) ? true : false;

          if (scope.display) {
            $(window).scroll(function () {
              scrolled = $(this).scrollTop();
            });
          }
          docHeight = $(document).height();
        },

        controller: function ($scope) {

          $scope.tapUp = function () {
            console.log("tapUp");
            scrolled = scrolled - 150;
            $('body').animate({ scrollTop: scrolled });
          };

          $scope.tapDown = function () {
            console.log("tapDown");
            scrolled = scrolled + 150;
            $('body').animate({ scrollTop: scrolled });
          };

          $scope.holdUp = function () {
            console.log("holdUp");
            //console.log($event.name + ': %o', $event);
            $('body').animate({ scrollTop: 0 });
          };

          $scope.holdDown = function () {
            console.log("holdDown");
            $('body').animate({ scrollTop: docHeight });
          };
        }
      }
  }); // directive end

Hope you can help thanks.

@ghost
Copy link

ghost commented Jun 9, 2016

Hi @feyyazakkus,
thanks for reporting.

I'll check it out asap!
Thanks.

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

No branches or pull requests

1 participant