Trigger jQuery animation when css class gets changed by unobtrusive validation

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前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏