Skip to content

Instantly share code, notes, and snippets.

@dboutote
Created March 15, 2016 01:46
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 dboutote/a2fae8f21d26821aae8b to your computer and use it in GitHub Desktop.
Save dboutote/a2fae8f21d26821aae8b to your computer and use it in GitHub Desktop.
(function ($) {
'use strict';
function change_avatar_div( e ){
var field = $(e.currentTarget);
var acw_avatar_div = field.closest('.acw-thumb-size-wrap').find('.acw-avatar');
if( acw_avatar_div.length ) {
var icon = $( '.acw-icon', acw_avatar_div);
var size = parseInt ( ($.trim( field.val() ) * 1) + 0 );
acw_avatar_div.css({
'height' : size + 'px',
'width' : size + 'px'
});
icon.css({ 'font-size' : size + 'px' });
}
return;
};
$('#wpcontent').on( 'change', '.acw-thumb-size', function ( e ) {
change_avatar_div( e );
return;
});
$('#wpcontent').on( 'keyup', '.acw-thumb-size', function ( e ) {
setTimeout( function(){
change_avatar_div( e );
}, 300 );
return;
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment