Fix forms.scrollToFirstError when there is no error to scroll to
This commit is contained in:
parent
2e96a387e9
commit
46afe40637
1 changed files with 2 additions and 1 deletions
|
@ -84,7 +84,8 @@ module.exports.setErrorToProperty = setErrorToProperty = (el, property, message,
|
|||
|
||||
module.exports.scrollToFirstError = ($el=$('body')) ->
|
||||
$first = $el.find('.has-error, .alert-danger, .error-help-block, .has-warning, .alert-warning, .warning-help-block').filter(':visible').first()
|
||||
$('html, body').animate({ scrollTop: $first.offset().top - 20 }, 300)
|
||||
if $first.length
|
||||
$('html, body').animate({ scrollTop: $first.offset().top - 20 }, 300)
|
||||
|
||||
module.exports.clearFormAlerts = (el) ->
|
||||
$('.has-error', el).removeClass('has-error')
|
||||
|
|
Reference in a new issue