开发者

When closing jQuery SimpleModal an error occurs within IE7

开发者 https://www.devze.com 2023-01-21 15:10 出处:网络
I just noticed a problem today within IE7 while using the jQuery plugin SimpleModal. I\'m not exactly sure what\'s causing it through. It also doesn\'t seem to happen with all of my modals only this o

I just noticed a problem today within IE7 while using the jQuery plugin SimpleModal. I'm not exactly sure what's causing it through. It also doesn't seem to happen with all of my modals only this one. Any ideas on what could be causing it would be great. The error that IE is showing is directly related to SimpleModal's file as well.

Line: 25
Char: 401
Error: 'a.d.overlay' is null or not an object
Code: 0
URL: <REMOVED>

Here is my code that seems to be causing this error to be thrown.

$(".addButton").click(addSymbol);

$(".cancel").live('click',closewindow);

var addMe = function(){
        $(".dialogue").emp开发者_运维问答ty();
        $(".dialogue").append('<img src="'+ _baseUrl + '/images/loading-spinner.gif"> Loading...');
        $(".dialogue").modal({
            opacity:80,
            overlayCss: {backgroundColor:"#fff"}
        });
        $.getJSON(
                _Url,
                function(json){
                    if(json.success){
                        refreshTable();
                    } else {
                        $(".dialogue").empty();
                        $(".dialogue").append('<table><tr><td><strong>Error</strong></td></tr><tr><td><b>' + json.error + '</b></td></tr><tr><td></td></tr><tr><td><img src="' + _baseUrl + '/images/bttnClose.png"  class="cancel" /></td></tr></table>');
                    }
                });
    }

var closewindow = function(e){
        e.preventDefault();
        $.modal.close();
    };

As you can see I'm not doing anything special. Please let me know if you have any ideas on what might be causing this.


According to the Simple Modal code.google page, jQuery 1.4.3 breaks SimpleModal in IE7. You can see the issue here.

I would try switching to jQuery 1.4.2 source and see if that fixes the issue in IE. Otherwise, I would consider switching plugins or working with the plugin writers of SimpleModal to debug the issue.


I receive the same issue in IE8 as well, but only when using the $.modal.close() command.

To resolve the issue, I simply added the class of simplemodal-close to my cancel button, and it closed without error.

This is apparently documented on the Project's page, and I have found it to be a sufficient resolution for the problem for now, until a fix is actually made.

http://www.ericmmartin.com/projects/simplemodal/#notes

0

精彩评论

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

关注公众号