Skip to content

Instantly share code, notes, and snippets.

@himedlooff
Created August 13, 2014 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himedlooff/7ee683e93f8137d3e7a4 to your computer and use it in GitHub Desktop.
Save himedlooff/7ee683e93f8137d3e7a4 to your computer and use it in GitHub Desktop.
(function( $ ) {
$.fn.revealOnFocus = function( userSettings ) {
return $( this ).each(function() {
var $this = $( this ),
$target = $this.find('.reveal-on-focus_target'),
$content = $this.find('.reveal-on-focus_content');
$content.hide();
$target.on('focus', function() {
var duration = $.fn.expandable.calculateExpandDuration( $content.height() );
$content.slideDown({
duration: duration,
easing: 'easeOutExpo'
});
});
});
};
// Auto init
$('.reveal-on-focus').revealOnFocus();
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment