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

  • Home
  • SEARCH
  • 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 8612165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:33:35+00:00 2026-06-12T04:33:35+00:00

(function ($) { $.fn.extend({ leanModal : function (options) { var defaults = { top

  • 0
(function ($) {
    $.fn.extend({
        leanModal : function (options) {
            var defaults = {
                top : 100,
                overlay : 0.5,
                closeButton : null
            };
            var overlay = $("<div id='lean_overlay'></div>");
            $("body").append(overlay);
            options = $.extend(defaults, options);
            return this.each(function () {
                var o = options;
                $(this).click(function (e) {
                    var modal_id = $(this).attr("href");
                    //$("#lean_overlay").click(function () {
                    //  close_modal(modal_id)
                    //});
                    $(o.closeButton).click(function () {
                        close_modal(modal_id)
                    });
                    var modal_height = $(modal_id).outerHeight();
                    var modal_width = $(modal_id).outerWidth();
                    $("#lean_overlay").css({
                        "display" : "block",
                        opacity : 0
                    });
                    $("#lean_overlay").fadeTo(200, o.overlay);
                    $(modal_id).css({
                        "display" : "block",
                        "position" : "fixed",
                        "opacity" : 0,
                        "z-index" : 11000,
                        "left" : 50 + "%",
                        "margin-left" :  - (modal_width / 2) + "px",
                        "top" : o.top + "px"
                    });
                    $(modal_id).fadeTo(200, 1);
                    e.preventDefault()
                })
            });
            function close_modal(modal_id) {
                $("#lean_overlay").fadeOut(200);
                $(modal_id).css({
                    "display" : "none"
                })
            }
        }
    })
})(jQuery);

this is from leanModal plugin – http://leanmodal.finelysliced.com.au/

how should i call this close_modal() function outside of above plugin? i want to close the popup dialog from an ajax call’s success callback. ajax call is inside an external js function.

  • 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-06-12T04:33:37+00:00Added an answer on June 12, 2026 at 4:33 am

    The point of this module construct is to avoid publishing some variables (including functions).

    So you can’t access what isn’t referenced in the returned object.

    Read this about this construct.

    In your case, if you don’t want to change the plugin to move the function in the returned object, the simplest is probably to do

    $("#lean_overlay").fadeOut(200);
    $(modal_id).css({
        "display" : "none"
    })
    

    where modal_id is the href attribute of your element.

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

Sidebar

Related Questions

(function($) { $.extend({ notify: function(options, duration) { var defaults = { inline: true, href:
I have the following situation: var Task = Backbone.Model.extend({ initialize: function() { }, save:
Below is the extend function in core javascript. It is same as $.extend() in
The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first
How to get rid of extended $.extend() function from a specific target object .
I'm pretty confused by one of the subtleties of the vimscript extend() function. If
It's very easy to copy a javascript object in jQuery using jQuery.extend() function call.
Given: (function() { function Foo() { } $.extend(Foo.prototype, { bar: 'hasBeer' }); }) Is
I can successfully do this: App.SomeCollection = Backbone.Collection.extend({ comparator: function( collection ){ return( collection.get(
Superfish JS is here . Here's the relevant code: $.fn.extend({ hideSuperfishUl : function() {

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.