杂记

1、在asp.net MVC集成的jquery.validate.js中获取单个表单的验证状态:

//以Email为例,通过返回true,否则返回false
$("Email").valid()

2、Jquery多事件集中写法

$(document).on("keyup mouseup", "#Email", function () {
       if($(this).valid())
       {

       }
});

 3、监听CSS动画结束

            $("body").on("animationend", ".bigicon", function (d) {
                if (d.originalEvent.animationName == "mymoverever") {
                    $(this).find(".circle").css("background", "#f6f5f5").css("border", "1px solid #ded7d7");
                    $(this).find(".title i").css("background", "#000");
                    $(this).find(".iconfont").css("color", "#000");
                    $(this).find(".title").css("color", "#000");
                }
            })

4、高版本Jquery判断IE及其版本

            if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE", "")) == 9) {
                $(".main-content").css("height", "27em");
                $(".bigicon .text").css("opacity", "10");
            }

5、Jquery判断IE8图片完全加载,需要complete后增加半秒到1秒的延时。

                    var timer = setInterval(function () {
                        if ($(".course-img img")[0].complete) {
                            clearInterval(timer);
                            setTimeout(function () {
                                var div_height = $(".course-img img").height() - 19;
                                $(".right-course div").css("height", div_height + "px");
                            }, 500);
                        }
                    }, 10);

 6、Remote验证与ValidateAntiForgeryToken相结合

//增加__RequestVerificationToken字段,同时将http方法改为Post
[Remote("CheckEmail", "Register", AdditionalFields = "__RequestVerificationToken", HttpMethod = "Post", ErrorMessage = "该邮箱已被使用,请换一个邮箱重试。")]

 

posted on 2019-06-25 12:55  静以修身俭以养德  阅读(175)  评论(0编辑  收藏  举报

导航