Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- var vibrateBool = false;
- var vibrateInterval = null;
- var vibrateIntervalTimerMs = 500;
- var vibrate = function() {
- if(vibrateBool) navigator.notification.vibrate();
- }
- $('h2.on').on('click', function() {
- $(this).removeClass('on').addClass('off');
- $(this).toggleClass('heart');
- vibrateBool = true;
- vibrateInterval = setInterval("vibrate()",vibrateIntervalTimerMs);
- });
- // Beroende på hur gammal jquery du har får du kanske
- // Byta ut till .click igen, men använd alltid .on()
- $('h2.off').on('click', function() {
- $(this).removeClass('off').addClass('on');
- $(this).toggleClass('heart');
- clearInterval(vibrateInterval);
- vibrateInterval = null;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment