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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:29:07+00:00 2026-05-21T09:29:07+00:00

I have installed a lightbox plugin and i would like to resue some if

  • 0

I have installed a lightbox plugin and i would like to resue some if its functionality for other parts of my application without having to recode a separate module since it would be kind of redundant, so is it possible to reuse/share some functions from a library like say from this one

http://www.notesfor.net/samples/jquery/notesforlightbox/js/nf.lightbox.js

My intention is this light box plug in already supports hotkeys for Next, Previous, Close etc…

Here is the situation… form the lightbox.js…
I want to reuse this particular function for another part of my application

(function($) {
$.fn.lightBox = function(settings) {

….
……
……
….. etc …

    function _keyboard_action(objEvent) {
        // To ie
        if (objEvent == null) {
            keycode = event.keyCode;
            escapeKey = 27;
            // To Mozilla
        } else {
            keycode = objEvent.keyCode;
            escapeKey = objEvent.DOM_VK_ESCAPE;
        }
        // Get the key in lower case form
        key = String.fromCharCode(keycode).toLowerCase();
        // Verify the keys to close the ligthBox
        if ((key == settings.keyToClose) || (key == 'x') || (keycode == escapeKey)) {
            _finish();
        }
        // Verify the key to show the previous image
        if ((key == settings.keyToPrev) || (keycode == 37)) {
            // If we´re not showing the first image, call the previous
            if (settings.activeImage != 0) {
                settings.activeImage = settings.activeImage - 1;
                _set_image_to_view();
                _disable_keyboard_navigation();
            }
        }
        // Verify the key to show the next image
        if ((key == settings.keyToNext) || (keycode == 39)) {
            // If we´re not showing the last image, call the next
            if (settings.activeImage != (settings.imageArray.length - 1)) {
                settings.activeImage = settings.activeImage + 1;
                _set_image_to_view();
                _disable_keyboard_navigation();
            }
        }
    }

….
……
……
….. etc …

};

})(jQuery);

but if i call : _keyboard_action(objEvent) from outside, i would get an error, so what is the correct syntax to do so?

  • 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-21T09:29:07+00:00Added an answer on May 21, 2026 at 9:29 am

    From what I understood from this post (and If I’m not misunderstood), you can simply use

    <script src="NameOfJavascriptFile.js" type="text/javascript">
    

    in your html <head> section and then call the functions like normal functions.

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

Sidebar

Related Questions

I have installed xampp on my Ubuntu machine, and would like to be able
I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages.
I have installed an application as a service and set the DependOnService to be
I have installed Eclipse Helios(3.6) and Google plugin to develope app in GAE/J.Then created
I have installed and setup RubyCAS-Server and RubyCAS-Client on my machine. Login works perfectly
I have installed CherryPy 3.1.0,. Here is what happens when I try to run
I have installed Delphi Prism and XNA Game Studio 3.0. I have managed to
I have installed Visual Studio 2008 and patch it with SP1. However, I cannot
I have installed Xperf performance analyzer from Windows SDK and captured a trace as
I have installed: Visual C# 2008 Express Visual Web Developer 2008 Express Visual Studio

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.