Last active
September 18, 2020 02:53
-
-
Save rodneyrehm/6464641 to your computer and use it in GitHub Desktop.
Rachel Nabors: touch and click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://coderwall.com/p/yzlqpq | |
(function($){ | |
function touch(event) { | |
event.preventDefault(); | |
var runFunc = $(this).data('activateRunFunc'); | |
runFunc && runFunc(); | |
} | |
function click(event) { | |
event.preventDefault(); | |
event.stopImmediatePropagation(); | |
var runFunc = $(this).data('activateRunFunc'); | |
runFunc && runFunc(); | |
} | |
$.fn.activate = function(runFunc) { | |
return $(this).data('activateRunFunc', runFunc).on({ | |
touchend: touch, | |
click: click | |
}); | |
}; | |
})(jQuery); |
$('your-selector').activate(function (event) {
console.log('event was dispatched', event)
})
does that help?
Thank you, it does.
…On Mon, Sep 23, 2019 at 3:29 PM Rodney Rehm ***@***.***> wrote:
$('your-selector').activate(function (event) {
console.log('event was dispatched', event)
})
does that help?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/6464641?email_source=notifications&email_token=AGZ6SBJT47TK2AHKOUVGPDTQLEYMXA5CNFSM4IZO4RGKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFZIXY#gistcomment-3035516>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGZ6SBNAM6LYLL35JD5UFV3QLEYMXANCNFSM4IZO4RGA>
.
--
Regards,
Andre Nell
972.672.6179
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you willing to explain what's happening here? Where do I place the functionality that I need once the event is triggered?