Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

Configuration of the file paths


Project:jQuery Lightbox Plugin (balupton edition)
Version:1.2.0-final
Component:Miscellaneous
Category:support request
Priority:minor
Assigned:Unassigned
Status:closed
Description

Hi there,

Before all, fantastic work with this plugin: is really usefull. I try to change the configuration options, and use a script like this to that:

// DOM ready!
$(function(){
  // Variables are defined at "lightbox.class.php"
  $.Lightbox.construct({
    'text':{
      'image': lightboxTextImage,
      'of': lightboxTextOf,
      'close': lightboxTextClose,
      'closeInfo': lightboxTextCloseInfo,
      'help':{
        'close': lightboxTextHelpClose,
        'interact': lightboxTextHelpInteract
      },
      'about':{
        'text': lightboxTextAboutText,
        'title': lightboxTextAboutTitle
      }
    } 
  });
});

However, I cant change the config for the "file paths", and I must be defined this in the plugin script, but, this confuse me, because if I touch the core of the plugin,... the updates are relative more complicated.

I try to define the configuration like "text" part, but, I think that the plugin try to load the default values before I defined the configuration, and the default values (file paths) cannot found in my system... and the plugin "crash".

What can I do? I forget something? Please, sorry my poor english and, in any case, congratulations for this fantastic jQuery plugin.

Comments

#1

Could you provide a url or sample I can download of the script playing up, so that I can debug what is going wrong. I will be away for a week, so will look at it when I get back.

Cheers for using this new feature, was not sure if it would catch on.

#2

Hello. I try some test, and the results are this. I have a script with the configuration of the plugin, something like this:

// DOM ready!
$(function(){
  $.Lightbox.construct({
    'files': {
      'js': {
        'lightbox': 'jquery.lightbox.js'
      },
      'css': {
        'lightbox': '../styles/jquery.lightbox.css'
      },
      'images': {
        'prev':   '../images/prev.gif',
        'next':   '../images/next.gif',
        'blank':    '../images/blank.gif',
        'loading':  '../images/loading.gif'
      }
    }
  });
});

But this code is executed after the "DOM ready" in the plugin. In fact no other change is here, because, if you try to execute the above code before the plugin are ready, you obtain a "$.Lightbox is not defined".

So, the plugin executed their own "DOM ready", and try to assign the default options (no other one can be set...) and try to assign the ".js" file of the plugin with the default option value, and this is wrong (in my case) because the path dont exists in the system.

So, the plugin crash with a "this.src" is not defined. I try to debug the problem, but, a dont have lucky. But the problem is a little big, because, in Firefox (I dont test in other browsers) I think that force to load a inexistent JavaScript file... and this sometime crash the entire browser.

If you change the default options values with the appropiate paths to the files (specially the path to the main plugin JS file) and you assert that is well, the above code is executed (after the plugin assign the default (and correct) options, and the options can be overwritten and everything is OK.

You can try this: include the plugin main JS file in a sample file, then, include a similar code that above in another "script". Assert that you change the default plugin options... in better words, assign a wrong path in the appropiate option to the main JS file path. Hope that you experiment the problem that I try to relate.

Also if you assign better paths in the "config file", you can view that plugin "crash" before the "config file" is loaded, if fact the file is not loaded, because the problem stopped the script execution. Sorry for my poor english. I hope that help you in anything. Please, sorry that I cannot prepare a patch to solve this issue.

#3

Ok, I attach a sample of issue to be reproduce the problem. Note that if you dont touch nothing, the plugin cant work. Study the options of "jquery.lightbox.js" (wrong in the case of the example that I attach) and then rename "jquery.lightbox.js_this-rules" to "jquery.lightbox.js" to use this file. Now the plugin rule: because the default options are OK. If you need other information tell me please.

AttachmentSize
jquery_lightbox.zip285.14 KB

#4

Status:active» closed

The problem is that it cannot find it's script tag used to generate the baseurl and do other things. The fix is to modify the files.js.lightbox location within the jquery.lightbox.js file, and then load in your custom locations. However this fix is illogical, so I have simplified the process so it now works out of the box with your provided sample.

So in short, this has been fixed in the upcoming version.

#5

Very good. Thanks for the reply!