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 3286722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:24:45+00:00 2026-05-17T20:24:45+00:00

(some code)(jQuery); What does this mean? (function (a) { function d(g) { return typeof

  • 0

(some code)(jQuery);

What does this mean?

(function (a) {
    function d(g) {
        return typeof g == "object" ? g : {
            top: g,
            left: g
        }
    }
    var b = a.scrollTo = function (g, e, f) {
        a(window).scrollTo(g, e, f)
    };
    b.defaults = {
        axis: "xy",
        duration: parseFloat(a.fn.jquery) >= 1.3 ? 0 : 1
    };
    b.window = function () {
        return a(window)._scrollable()
    };
    a.fn._scrollable = function () {
        return this.map(function () {
            if (!(!this.nodeName || a.inArray(this.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1)) return this;
            var g = (this.contentWindow || this).document || this.ownerDocument || this;
            return a.browser.safari || g.compatMode == "BackCompat" ? g.body : g.documentElement
        })
    };
    a.fn.scrollTo = function (g, e, f) {
        if (typeof e == "object") {
            f = e;
            e = 0
        }
        if (typeof f == "function") f = {
            onAfter: f
        };
        if (g == "max") g = 9E9;
        f = a.extend({}, b.defaults, f);
        e = e || f.speed || f.duration;
        f.queue = f.queue && f.axis.length > 1;
        if (f.queue) e /= 2;
        f.offset = d(f.offset);
        f.over = d(f.over);
        return this._scrollable().each(function () {
            function k(w) {
                j.animate(r, e, f.easing, w &&
                function () {
                    w.call(this, g, f)
                })
            }
            var h = this,
                j = a(h),
                i = g,
                m, r = {},
                u = j.is("html,body");
            switch (typeof i) {
            case "number":
            case "string":
                if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(i)) {
                    i =
                    d(i);
                    break
                }
                i = a(i, this);
            case "object":
                if (i.is || i.style) m = (i = a(i)).offset()
            }
            a.each(f.axis.split(""), function (w, v) {
                var q = v == "x" ? "Left" : "Top",
                    s = q.toLowerCase(),
                    y = "scroll" + q,
                    D = h[y],
                    H = b.max(h, v);
                if (m) {
                    r[y] = m[s] + (u ? 0 : D - j.offset()[s]);
                    if (f.margin) {
                        r[y] -= parseInt(i.css("margin" + q)) || 0;
                        r[y] -= parseInt(i.css("border" + q + "Width")) || 0
                    }
                    r[y] += f.offset[s] || 0;
                    if (f.over[s]) r[y] += i[v == "x" ? "width" : "height"]() * f.over[s]
                } else {
                    q = i[s];
                    r[y] = q.slice && q.slice(-1) == "%" ? parseFloat(q) / 100 * H : q
                }
                if (/^\d+$/.test(r[y])) r[y] = r[y] <= 0 ? 0 : Math.min(r[y], H);
                if (!w && f.queue) {
                    D != r[y] && k(f.onAfterFirst);
                    delete r[y]
                }
            });
            k(f.onAfter)
        }).end()
    };
    b.max = function (g, e) {
        var f = e == "x" ? "Width" : "Height",
            k = "scroll" + f;
        if (!a(g).is("html,body")) return g[k] - a(g)[f.toLowerCase()]();
        f = "client" + f;
        var h = g.ownerDocument.documentElement,
            j = g.ownerDocument.body;
        return Math.max(h[k], j[k]) - Math.min(h[f], j[f])
    }
})(jQuery);
  • 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-17T20:24:45+00:00Added an answer on May 17, 2026 at 8:24 pm

    It is a closure.

    It is a part of your code that can have own variables that will not be shared with the rest of your code.

    And the final parenthesis have the parameters passed to this closure.

    Like this:

    (function (what, howmany){
        for (var i = howmany; i--;){
            alert(what);
        }
    })("John",3);
    

    In your example the closure is being calling with jquery object as parameter.

    With this you can isolate the execution of this part of your code. It is powerful and must be well know to programming real javascript.

    To view more information about closures in javascript see this: http://jibbering.com/faq/notes/closures/

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

Sidebar

Related Questions

I have some jQuery code. I have called an Ajax function file, file.php, that
I have some jQuery/JavaScript code that I want to run only when there is
I have some code like this in a winforms app I was writing to
Here is some code I could not get to format properly in markdown, this
I have added some code which compiles cleanly and have just received this Windows
In some code I've inherited, I see frequent use of size_t with the std
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
I'm maintaining some code that uses a *= operator in a query to a
Basically I have some code to check a specific directory to see if an
I have written some code in my VB.NET application to send an HTML e-mail

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.