开发者

jQuery .after() not showing in IE 7

开发者 https://www.devze.com 2023-03-11 00:40 出处:网络
I\'m having a little trouble with a jQuery plugin wrote. I\'ve got it working in every browser I want it to work in (IE 8+, Chrome, Firefox, Safari, Opera) but it doesn\'t work in IE7. Here is the jQu

I'm having a little trouble with a jQuery plugin wrote. I've got it working in every browser I want it to work in (IE 8+, Chrome, Firefox, Safari, Opera) but it doesn't work in IE7. Here is the jQuery plugin

        (function($) {
        $.fn.popup = function() {
            return this.each(function() {

                $(this).click(function(e){

                    var url = $(this).find('a:eq(0)').attr('href');

                        $('body').after('<div id="pu_bg" class="close"></div>');
                        $('body').afte开发者_运维百科r('<div id="pu_content_container">' +
                        '<div id="pu_close_button" class="close"></div>' +
                        '<div id="pu_content">' +
                        'Loading...' +
                        '</div>' +
                        '</div>');
                        $('#pu_bg').height($(document).height());
                        $('#pu_content').load(url);
                        e.preventDefault();

                });

                $('.close').live('click',function() {
                    $('#pu_content_container').hide('slow', function(){
                        $('#pu_bg').fadeOut('fast');
                    });
                });

            });
        }

    })(jQuery);

In IE 7 absolutely NOTHING happens. Is there a jQuery function not supported by IE 7? (although I'm sure jQuery is 100% cross browser compatible), have I done something wrong? or is IE7 being fussy and I need to create a work around?

PLEASE HELP! I'm getting really frustrated with this!

Thanks in advance, Lee


I'm surprised this works in any browser, since you are trying to append elements after the body element. I think you probably want append and not after.

0

精彩评论

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