Last active
September 12, 2016 22:01
-
-
Save noahub/e7f12d4c78a3a35bb2727c079d178cb8 to your computer and use it in GitHub Desktop.
Focus and Glow
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
<style> | |
.glow {text-shadow: 0 0 5px rgba(81, 203, 238, 1);} | |
.focusGlow { | |
box-shadow: 0 0 5px 1px rgba(81, 203, 238, 1) !important; | |
border: 1px solid rgba(81, 203, 238, 1) !important; | |
-webkit-animation: shadow 0.5s ease-in-out infinite !important; | |
-moz-animation: shadow 0.5s ease-in-out infinite !important; | |
animation: shadow 0.5s ease-in-out infinite !important; | |
} | |
@-webkit-keyframes shadow { | |
0% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
50% {box-shadow:0 0 0 15px rgba(81, 203, 238, 1) !important;} | |
100% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
} | |
@-moz-keyframes shadow { | |
0% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
50% {box-shadow:0 0 0 15px rgba(81, 203, 238, 1) !important;} | |
100% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
} | |
@keyframes shadow { | |
0% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
50% {box-shadow:0 0 0 15px rgba(81, 203, 238, 1) !important;} | |
100% {box-shadow:0 0 0 1px rgba(81, 203, 238, 1) !important;} | |
} | |
</style> |
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
<script> | |
var focusOnLoad = true; //By default, first form field is focused automatically on page load. Change this value to 'False' to disable this. | |
var scrollButton = "#lp-pom-button-25"; //Replace this with the ID of your button. To target all buttons, replace ID with: "a[href^=#]" | |
$(':input, .lp-pom-form .lp-pom-button').focus(function(){ | |
$(this).addClass('focusGlow'); | |
}); | |
$(':input, .lp-pom-form .lp-pom-button').blur(function(){ | |
$(this).removeClass('focusGlow'); | |
}); | |
if (focusOnLoad){ | |
$('input:not([type=hidden]):first').focus().addClass('focusGlow'); | |
} | |
lp.jQuery(function($) { | |
// The speed of the scroll in milliseconds | |
var speed = 1000; | |
// Find links that are #anchors and scroll to them | |
$(scrollButton) | |
.not('.lp-pom-form .lp-pom-button') | |
.unbind('click.smoothScroll') | |
.bind('click.smoothScroll', function(event) { | |
event.preventDefault(); | |
$('html, body').animate({ scrollTop: $( $(this).attr('href') ).offset().top }, speed, function(){ | |
$('input:not([type=hidden]):first').focus().addClass('focusGlow').select(); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment