Post edit link: focus the form on click
This commit is contained in:
parent
c4d5263422
commit
2f8d43cb4b
1 changed files with 11 additions and 8 deletions
|
@ -12,17 +12,20 @@ $(function()
|
||||||
var tags = [];
|
var tags = [];
|
||||||
$.getJSON('/tags?json', function(data)
|
$.getJSON('/tags?json', function(data)
|
||||||
{
|
{
|
||||||
|
aDom.removeClass('inactive');
|
||||||
|
var formDom = $('form.edit-post');
|
||||||
tags = data['tags'];
|
tags = data['tags'];
|
||||||
|
|
||||||
|
if (!$(formDom).is(':visible'))
|
||||||
|
{
|
||||||
var tagItOptions = getTagItOptions();
|
var tagItOptions = getTagItOptions();
|
||||||
tagItOptions.availableTags = tags;
|
tagItOptions.availableTags = tags;
|
||||||
tagItOptions.placeholderText = $('.tags input').attr('placeholder');
|
tagItOptions.placeholderText = $('.tags input').attr('placeholder');
|
||||||
$('.tags input').tagit(tagItOptions);
|
$('.tags input').tagit(tagItOptions);
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
var formDom = $('form.edit-post');
|
|
||||||
formDom.show().css('height', formDom.height()).hide().slideDown();
|
formDom.show().css('height', formDom.height()).hide().slideDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
formDom.find('input[type=text]:visible:eq(0)').focus();
|
||||||
$('html, body').animate({ scrollTop: $(formDom).offset().top + 'px' }, 'fast');
|
$('html, body').animate({ scrollTop: $(formDom).offset().top + 'px' }, 'fast');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue