Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7543447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:25:51+00:00 2026-05-30T08:25:51+00:00

I’m having some problems regarding a jQuery modal window. I’m a dba and SQL

  • 0

I’m having some problems regarding a jQuery modal window. I’m a dba and SQL programmer and my goal is to build up a query which dynamically builds an HTML which contains a flash which links to a modal window that has another flash in it. Well the query is done and works flawlessly. However, I tried it on Internet Explorer and (unlike firefox and chrome) when you want to close the modal window it closes the whole browser window (with a warning message that says “beware, the browser’s trying to close this tab etc”).

I used an already existing jquery modal window code and styling (I believe that both matter). The problem is, that the whole query is done and if I change the whole jquery modal window, I’ll have to change the query’s logic, and drastically (believe me, I’ve checked).

So, my fastest solution would be to correct the jQuery code that is messing up the whole close thing (changing the sql stored proc would take a LOT of work). This is because the original example I used as a reference had this problem (I just didn’t notice, due to jQuery supposively being a cross-browser solution for everything). You will see that it works flawlessly on FF and Chrome but not in IE
Here’s the link: http://www.mediafire.com/?mcz70n870qmjch9

Thanks a lot!!!

Just in case I’m posting the code here as well:

/// <reference path="jquery-1.3.2.min-vsdoc.js" />

/************************************************************************************************************
* SIMPLE MODAL v 2.0
* © 2009 FISHBOWL MEDIA LLC
* http://fishbowlmedia.com
***********************************************************************************************************/

(function ($) {

    /**********************************
    * CUSTOMIZE THE DEFAULT SETTINGS
    * Ex: 
    * var _settings = {
    *   id: 'modal',
    *   src: function(sender){
    *       return jQuery(sender).attr('href');
    *   },
    *   width: 800,
    *   height: 600
    * }
    **********************************/
    var _settings = {
        width: 800, // Use this value if not set in CSS or HTML
        height: 600, // Use this value if not set in CSS or HTML
        overlayOpacity: .85, // Use this value if not set in CSS or HTML
        id: 'modal',
        src: function (sender) {
            return jQuery(sender).attr('href');
        },
        fadeInSpeed: 0,
        fadeOutSpeed: 0
    }

    /**********************************
    * DO NOT CUSTOMIZE BELOW THIS LINE
    **********************************/
    $.modal = function (options) {
        return _modal(this, options);
    }
    $.modal.open = function () {
        _modal.open();
    }
    $.modal.close = function () {
        _modal.close();
    }
    $.fn.modal = function (options) {
        return _modal(this, options);
    }
    _modal = function (sender, params) {
        this.options = {
            parent: null,
            overlayOpacity: null,
            id: null,
            content: null,
            width: null,
            height: null,
            modalClassName: null,
            imageClassName: null,
            closeClassName: null,
            overlayClassName: null,
            src: null
        }
        this.options = $.extend({}, options, _defaults);
        this.options = $.extend({}, options, _settings);
        this.options = $.extend({}, options, params);
        this.close = function () {
            jQuery('.' + options.modalClassName + ', .' + options.overlayClassName).fadeOut(_settings.fadeOutSpeed, function () { jQuery(this).unbind().remove(); });
        }
        this.open = function () {
            if (typeof options.src == 'function') {
                options.src = options.src(sender)
            } else {
                options.src = options.src || _defaults.src(sender);
            }

            var fileExt = /^.+\.((jpg)|(gif)|(jpeg)|(png)|(jpg))$/i;
            var contentHTML = '';
            if (fileExt.test(options.src)) {
                contentHTML = '<div class="' + options.imageClassName + '"><img src="' + options.src + '"/></div>';

            } else {
                contentHTML = '<iframe width="' + options.width + '" height="' + options.height + '" frameborder="0" scrolling="no" allowtransparency="true" src="' + options.src + '">&lt/iframe>';
            }
            options.content = options.content || contentHTML;

            if (jQuery('.' + options.modalClassName).length && jQuery('.' + options.overlayClassName).length) {
                jQuery('.' + options.modalClassName).html(options.content);
            } else {
                $overlay = jQuery((_isIE6()) ? '<iframe src="BLOCKED SCRIPT\'&lt;html&gt;&lt;/html&gt;\';" scrolling="no" frameborder="0" class="' + options.overlayClassName + '"></iframe><div class="' + options.overlayClassName + '"></div>' : '<div class="' + options.overlayClassName + '"></div>');
                $overlay.hide().appendTo(options.parent);

                $modal = jQuery('<div id="' + options.id + '" class="' + options.modalClassName + '" style="width:' + options.width + 'px; height:' + options.height + 'px; margin-top:-' + (options.height / 2) + 'px; margin-left:-' + (options.width / 2) + 'px;">' + options.content + '</div>');
                $modal.hide().appendTo(options.parent);

                $close = jQuery('<a class="' + options.closeClassName + '"></a>');
                $close.appendTo($modal);

                var overlayOpacity = _getOpacity($overlay.not('iframe')) || options.overlayOpacity;
                $overlay.fadeTo(0, 0).show().not('iframe').fadeTo(_settings.fadeInSpeed, overlayOpacity);
                $modal.fadeIn(_settings.fadeInSpeed);

                $close.click(function () { jQuery.modal().close(); });
                $overlay.click(function () { jQuery.modal().close(); });
            }
        }
        return this;
    }
    _isIE6 = function () {
        if (document.all && document.getElementById) {
            if (document.compatMode && !window.XMLHttpRequest) {
                return true;
            }
        }
        return false;
    }
    _getOpacity = function (sender) {
        $sender = jQuery(sender);
        opacity = $sender.css('opacity');
        filter = $sender.css('filter');

        if (filter.indexOf("opacity=") >= 0) {
            return parseFloat(filter.match(/opacity=([^)]*)/)[1]) / 100;
        }
        else if (opacity != '') {
            return opacity;
        }
        return '';
    }
    _defaults = {
        parent: 'body',
        overlayOpacity: 85,
        id: 'modal',
        content: null,
        width: 800,
        height: 600,
        modalClassName: 'modal-window',
        imageClassName: 'modal-image',
        closeClassName: 'close-window',
        overlayClassName: 'modal-overlay',
        src: function (sender) {
            return jQuery(sender).attr('href');
        }
    }
})(jQuery);

And the style:

.modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #131313;
    opacity: .85;
    filter: alpha(opacity=85);
    z-index: 101;
}
.modal-window {
    position: fixed;
    top: 50%;
    left: 50%;
    margin: 0;
    padding: 0;
    z-index: 102;
    background: #fff;
    border: solid 8px #000;
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
}
.close-window {
    position: absolute;
    width: 47px;
    height: 47px;
    right: -23px;
    top: -23px;
    background: transparent url(../images/close-button.png) no-repeat scroll right top;
    text-indent: -99999px;
    overflow: hidden;
    cursor: pointer;
}

Thanks a ton in advance everyone =-)


EDIT: Daniele suggested that the problem might be on this line:

jQuery('.' + options.modalClassName + ', .' + options.overlayClassName).fadeOut(_settings.fadeOutSpeed, function () { jQuery(this).unbind().remove(); });

I did what he suggested and the result was this: It still doesn’t work at all on IE (meaning that it still asks to close the whole window and not just the modal), and correctly shows and closes a first modal in FF and chrome, but after closing the first one its not able to correctly show another one.


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:25:53+00:00Added an answer on May 30, 2026 at 8:25 am

    Replace close() method of modal with closeModal or something similar:

    $.modal.closeModal = function () {
        _modal.closeModal();
    }
    

    […]

    this.closeModal = function () {
            jQuery('.' + options.modalClassName + ', .' + options.overlayClassName).fadeOut(_settings.fadeOutSpeed, function () { jQuery(this).unbind().remove(); });
        }
    

    […]

    $close.click(function () { jQuery.modal().closeModal(); });
                $overlay.click(function () { jQuery.modal().closeModal(); });
    

    for me it works…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.