What I am trying to do is to fade in validation summary slowly when errors found.
I am using ASP.NET MVC 4 with unobtrusive jQuery validation.
Validation works well. When issues are found css class of the summary `div` switches from `validation-summary-valid` to `validation-summary-errors`.
**I don't want to hook into validation events**, because I want to keep validation logic and look and feel separated. So my goal is to to detect that css class switch over and trigger some animation (fadeIn for instance). In this case the script responsible for animation will not be aware of validation, just of css classes. The only cross-browser way would be a very bad way to handle it. setInterval. If you want to keep the two separate, create an object of some sort that both elements of your application interface with. When the validation occurs, trigger a handler in the common object that will then control what your look and feel does. Or, you can trigger a global event from inside your validation and control it with that.
以上就是Trigger jQuery animation when css class gets changed by unobtrusive validation的详细内容，更多请关注web前端其它相关文章！