Click Here!
Do you want to add this to your site? You can import Quark in your page firstly as following (or by CommonJs).
<script
type="text/javascript"
src="https://g.alicdn.com/hub/quark/1.9.1024/scripts/index.min.js"
/>
And then insert following JavaScript code.
var qEle = AliHub.Elements;
// Bind a click event handler to an element. Suppose there is a DOM <div id="idOrElementOfTheDomToBind"></div> in the page.
// See AliHub.Elements.onClick(element, options) function for details.
qEle.onClick("idOrElementOfTheDomToBind", {
start: 3, // The count clicked to occur specific handler at least.
count: 100, // The count to allow occur at most.
span: 400, // The time span in millisecond between two clicks at most.
process: function (event, count, options) { // A handler to occur.
// event is the MouseEvent.
// count is the count clicked currently now.
// options is the object of this.
// This is an example to popup something.
qEle.popup({
orientation: qEle.PeripheralOrientations.Bottom, // The position: Top = 1, Right = 2, Bottom = 3, Left = 4.
render: function (info) {
var container = info.container().innerHTML((count + 1).toString());
}
});
}
});
But wait, if I want to listen something that is not about clicking nor element binding. What should I do? Ah, the good news is that we have a powerful utility for it! You can code following stuffs to create a full customized continuity task with counting and configuration.
var qCore = AliHub.Common;
// Creates a function that can handler the task configured by you for continuity task.
// See AliHub.Common.getContinuityTask(options) function for details.
var hitProc = qCore.getContinuityTask({
start: 3, // The count clicked to occur specific handler at least.
count: 100, // The count to allow occur at most.
span: 400, // The time span in millisecond between two clicks at most.
process: function (count, options) { // A handler to occur.
// count is the count clicked currently now.
// options is the object of this.
}
});
// It will return a function so that you can call it anywhere you want to process, such as clicking.
$("#idOrElementOfTheDomToBind").on("click", function ()
hitProc();
});
Note:
You can also import DataSense library to enable the similar features instead of Quark.
See HitTask for details.