0

下面是我的 JQuery 代码:

 $("#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.slideFadeToggle = function(easing, callback) {
                            return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);
                        };

从上面的代码中,当我单击一个按钮时,会弹出一个带有一些幻灯片动画的弹出窗口,它适用于除 IE8 之外的所有其他浏览器,谁能告诉我我在哪里做错了

谢谢

4

1 回答 1

1

我找到了解决方案

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

$("#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;
                    });

现在它工作正常:)

于 2011-04-06T09:13:27.563 回答