开发者

JQuery Toggle Problem in IE8

开发者 https://www.devze.com 2023-02-22 04:19 出处:网络
below is my JQuery code: $(\"#contact\").live(\'click\', function(event) { $(this).addClass(\"selected\").parent().append(\'<form name=\"emailform\"><div class=\"messagepop pop\"><p&g

below is my JQuery code:

 $("#contact").live('click', function(event) {
                            $(this).addClass("selected").parent().append('<form name="emailform"><div class="messagepop pop"><p><label for="sname">Your Name</label><input type="text" size="30" name="sname" id="sname" /></p><p><label for="email">Your Email</label><input type="text" size="30" name="email" id="email" /></p><p><input type="submit" value="Send Reservation Summary" name="commit" id="message_submit" class="btn"/>&nbsp;&nbsp;<button class="btn close">Cancel</button></p></div></form>');
                            $(".pop").slideFadeToggle(function() {
                                $("#sname").focus();
                            });
                            return false;
                        });

 $.fn.slideFadeTog开发者_如何学Cgle = function(easing, callback) {
                            return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);
                        };

From the above code, when I click a button, a popup will popped up with some slide animation, it works fine with every other browser except in IE8, can anybody tell me where did I make the wrong turn

Thanks


I found the solution

add $.fn.slideFadeToggle = function(easing, callback) { return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback); };

before

$("#contact").live('click', function(event) {
                        $(this).addClass("selected").parent().append('<form name="emailform"><div class="messagepop pop"><p><label for="sname">Your Name</label><input type="text" size="30" name="sname" id="sname" /></p><p><label for="email">Your Email</label><input type="text" size="30" name="email" id="email" /></p><p><input type="submit" value="Send Reservation Summary" name="commit" id="message_submit" class="btn"/>&nbsp;&nbsp;<button class="btn close">Cancel</button></p></div></form>');
                        $(".pop").slideFadeToggle(function() {
                            $("#sname").focus();
                        });
                        return false;
                    });

Now it works fine :)

0

精彩评论

暂无评论...
验证码 换一张
取 消