Created
July 17, 2018 09:27
-
-
Save sangar82/c3df9bd8c50c86bdd602a22acfb448a5 to your computer and use it in GitHub Desktop.
Vibrate DOM element
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
var vibrate = function() { | |
var shake= 3; | |
$(".actionsMode[mode='on']").stop(true, false) | |
.css({ | |
position: 'relative', | |
left: Math.round(Math.random() * shake) - ((shake + 1) / 2) + 'px', | |
top: Math.round(Math.random() * shake) - ((shake + 1) / 2) + 'px' | |
}); | |
}; | |
var stop_vibrate = function() { | |
clearInterval(vibrateIndex); | |
$(".actionsMode[mode='on']").stop(true,false) | |
.css({position: 'static', left: '0px', top: '0px'}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment