Skip to content

Instantly share code, notes, and snippets.

@ashsaraga
Created March 16, 2018 04:46
Show Gist options
  • Save ashsaraga/317fea32c8d8d6c066cd359a172d4b08 to your computer and use it in GitHub Desktop.
Save ashsaraga/317fea32c8d8d6c066cd359a172d4b08 to your computer and use it in GitHub Desktop.
Toggle focus on target element, get value from input.
$(document).ready(function() {
whiteRabbit();
madHatter();
marchHare();
function whiteRabbit() {
var stopwatch;
drinkMe();
}
function drinkMe() {
stopwatch = setTimeout(function() { $('#Alice').addClass('gardenPath'); }, 500);
}
function eatMe() {
clearTimeout(stopwatch);
$('#Alice').removeClass('gardenPath');
}
function madHatter() {
$('.links__fastlane').hover( eatMe, drinkMe );
$('.links__fastlane').focus( eatMe );
$('.links__fastlane').blur( drinkMe );
$('.links__custom').hover( eatMe, drinkMe );
$('.links__custom').focus( eatMe );
$('.links__custom').blur( drinkMe );
}
function marchHare() {
var mirror = $('#Haiga');
var teacup = $('.progress__percentage');
var disposition = $(mirror).val();
var earlGrey = disposition / 10000 * 100;
$(teacup).text(earlGrey+'%');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment