JQuery.tap.js plugin tap event execution two times problem __js

Source: Internet
Author: User
JQuery.tap.js
/** * Author:sergey Bondarenko (br0ken) * e-mail:broken@propeople.com.ua * GITHUB:HTTPS://GITHUB.COM/BR0KEN-/JTAP *

  Updated:may, 2014 * version:0.2.8 * (function ($, _) {' Use strict ';
   /** * @param (object) Ev-extending object, which contain event properties.
   *-(String) Start-start event depending of @isTap.
   *-(String) End-start event depending of @isTap.

  * * var ev = {start: ' Touchstart MouseDown ', end: ' Touchend MouseUp '};
        $.event.special[_] = {setup:function () {$ (). Off (' click '). On (Ev.start + ' + ev.end, function (e) {
         /** * Adding JQuery event to @ev object depending of @isTap. * Attention:value of this property would change two time * per Event:first time-on start, second-
         On end. * * ev. E = e.originalevent.changedtouches?
      E.originalevent.changedtouches[0]: E; }. On (Ev.start, function (e) {/** * function stop if evenT is simulate by mouse.
        */if (E.which && E.which!== 1) {return;
         /** * Extend @ev object from event properties of initial phase.
        * * Ev.target = E.target;
        Ev.time = new Date (). GetTime (); Ev. X = ev.
        E.pagex; Ev. Y = ev.
      E.pagey; }. On (Ev.end, function (e) {/** * Compare property values of initial phase with properties * This, final, phase.
         Execute event If values would be * within the acceptable and set new properties for event. */if (Ev.target = = E.target && (new Date (). GetTime ()-Ev.time) < 750) &&am
          P (EV. X = = ev. E.pagex && ev. Y = = ev.
          E.pagey)) {E.type = _; E.pagex = ev.
          E.pagex; E.pagey = ev.

          E.pagey;
        $.event.dispatch.call (this, e);
    }
      });
     },/** * disassembling event. * * Remove:Function () {$ (this). Off (Ev.start, false). Off (Ev.end, false);

  }
  }; $.fn[_] = function (FN) {return THIS[FN?
  ' On ': ' Trigger '] (_, FN);
}; }) (JQuery, ' tap ');
DEMO Reference http://www.cnblogs.com/shenbin/archive/2013/03/21/2973858.html
<! DOCTYPE html> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.