Those things on the mobile end; good jq plug-in for hammer ., Hammerjq
From the pc end to the mobile end, I believe that many front-end siege engineers are worried about the mobile end. It is very laborious to write the original audio on the mobile phone end, And the jq click has a latency of 300 milliseconds, now we have a good jq plug-in, hammer. javascript is an open-source and lightweight javascript library that can recognize the touch without relying on other things. mouse events support various mobile phone events, such as scaling and left-sliding qq deletion, zoom in and rotate.
Next we will use a tab switch to introduce hammer.
Usage:
1. First introduce jq2.0 and later versions and jquery. hammer. js.
2. Get the element. Just like jq, add hammer to the end and var hammertime = $ ('. tabs A'). hammer ();
3. You can directly add the event hammertime. on ('Tap ', function (ev) {} using the tap Click Event in hammer. Function can write your own js.
hammer.dragstart =
function
(ev) { };
// Start dragging </span>
hammer.drag =
function
(ev) { };
// Dragging </span>
hammer.dragend =
function
(ev) { };
// Drag the end </span>
hammer.onswipe =
function
(ev) { };
// Slide </span>
hammer.tap =
function
(ev) { };
// Click </span>
hammer.doubletap =
function
(ev) { };
// Double-click </span>
hammer.hold =
function
(ev) { };
// Long press </span>
hammer.release =
function
(ev) { };
// Exit the screen with your fingers </span>
Experience link: http://hammerjs.github.io/
Js code
1 $ (function () {2 var hammertime = $ ('. tabs '). hammer (); 3 hammertime. on ('tap', function (ev) {4 $ (this ). addClass ('actives '). siblings (). removeClass ('actives'); // Add a class to remove at the same level. 5 var index = $ ('. tabs '). index (this); // index 6 $ ('. tab-bott '). eq (index ). show (). siblings (). hide (); 7}) 8 })
Recommended front-end Group: Group Name: html5/css3/js/jq/nodejs/div group number: 339840649 join the discussion.