Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

doc: 'focus' option is not scrolling properly in demo page (Firefox) #282

Closed
nelson6e65 opened this issue Mar 4, 2016 · 2 comments
Closed
Assignees

Comments

@nelson6e65
Copy link
Contributor

http://1000hz.github.io/bootstrap-validator/

When you left 'email' (for example) with errors and click Submit button while field is not visible, focus works but do not scrolls to field to make it visible in the page.

This occurs in Firefox; in Chrome works fine.

@1000hz
Copy link
Owner

1000hz commented Mar 4, 2016

Looks like I need to select $('html, body') for scrolling instead of just $(document.body) for better cross-browser support.

@1000hz 1000hz self-assigned this Mar 4, 2016
@nelson6e65
Copy link
Contributor Author

Actually, in my project I had to use $("#page-wrapper") due to my layout, because I had the same issue if I use $('html, body'). 😔

After I update to v0.10.1, it works the focus in my layout without include #128.

$("#page-wrapper").stop().animate({ scrollTop: 0 }, 500, 'swing', function() {
    $(".has-error:first :input").focus();
});

But, I think the problem is about 'animate' 😅. So I was about to just left $(".has-error:first :input").focus(); without animation because I didn't got any clue how to scroll animation to my exactly field with errors.

@1000hz 1000hz closed this as completed in 39ef38c Jul 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants