Using the library FullAjax can face the fact that other scripts (eg LightBox) refuse to work or its not working correctly. The reason these scripts from which refuse to work is very simple – they are not quite designed to works with AJAX.

How can fix it I try describe in a few lines below …

The main reason (but not only) in which some scripts refuse to work together with AJAX – is that they do not “see” when AJAX page loaded and ready for use. To fix this need to tell them yourself when the page is “ready”.

For this, after when the AJAX page loading finished need tell for scripts that page updated.
For this can use “load” event from FullAJAX (example for mootools fireEvent()):

FLAX.Html.onall('load', function(options){
	window.fireEvent('domready');
});

or use callback function:

function doSomethingAfterFAjxPagLoad (){
	window.fireEvent('domready');
};

To this function is triggered after when the AJAX page loading finished, in the basic configuration the FullAjax library need add option onload:doSomethingAfterFAjxPagLoad .
Example:

FLAX.Filter.add({url:'/', id:fullAjaxId,  onload:doSomethingAfterFAjxPagLoad}); 
.... 
function doSomethingAfterFAjxPagLoad (){
/* fix for mootools 'domready', uncomment if need*/
/*	window.fireEvent('domready'); */
};

When using window.fireEvent(‘domready’); you should be careful.
Firstly it helps only if the script really does not “see” when the page is “ready”.
Second, by joint use with other scripts that work with AJAX good – it can lead to additional undesirable errors such as double execution of the script. Therefore this function in the plugin by default commented out.

In some cases, you should use window.fireEvent(‘load’); – it all depends on the script that “refuses” to work.

If script (eg LightBox) need only on a certain page then the function from above to better execute on only this page, not on each page. This will prevent any additional errors.
Example for the page “Gallery” ( mysite.com/galery ):

1
2
3
if(location.toString().indexOf('/galery') != -1){
	window.fireEvent('domready'); 
}

To be continued, maybe … :)

91 Comments to “ Problems using LightBox and some other scripts ”

  1. poorya says:

    Thank you!
    It works!

  2. Nelec says:

    Sorry! First of all, many many thanks for your work. this plugin is amazing. I have been looking for something similar since longtime.

    BUt I have some problemsm, I tried to follow your explanations here, and it seems as I cannot understand.

    I have a module that has to be loaded just in one voice of my menu, but when I open this page, fullajax load just the content and there is no module.

    I didn’t understand how should I edit your script probably.
    Could you make an example for me?
    Let’s say the module name is “search_module”, the jdoc position is “left”, and the menu voice where it should be loaded is “archive”, how should I edit your script? what should I write and what should I delete?

    Many thanks for your help. Hope you will save me.

  3. tim says:

    Hey great dev,
    thx for the nice Plugin! :)

    Is there a possibility to use the modalbox beside the fullajax system? I always get
    “����” hundreds of thounds of such lines.. :-(
    This is really a pity!

    May you help me?

    Thx & greetz
    tim

    • Fedik says:

      Hi tim,
      You tried all from this post? ;)
      And whether modalbox works without a fullajax?
      For help I need look you site.

  4. tim says:

    Hi Fedik,

    thx for answering, I have the joomla in our students network. It’s no public access yet.

    Well, without activating your plugin it works pretty well. I tried very much, like jce-mediabox, yoo gallery, bottlebot and so on. When I open the site like this http://www.example.com/examplesite
    then it works, but when I click around and get this link http://www.example.com/examplesite#ajx/examplesite again. I’m not able to open up any lightbox popup.

    Would be very nice, because we want do a kind of radio-site.

    Thx in advance!

    • Fedik says:

      if things from this post not helped need look how the lightbox initialised … then add a changes in FullAjax configuration

  5. tim says:

    Is there a possibility to say to the script, that if there is a picture, to not open the picture in the same way like an article?

    Because the script tries to open a picture like a website.

    I managed again that what you’ve written above. But the problem, that the script wants to open the picture is still there :-(

    • Fedik says:

      yes, possible, try add in configuration the code like next:

      SRAX.Filter.add({url:'/folder-pictures-name/', type:'nowrap'});

      but I not sure whether it helps, think still need again initialise the lightbox script after AJAX loading

  6. tim says:

    :-)
    That was it!

    Many, many thx!

    This and the hint above (Js code, parameters for FullAjax). At first I edited the JS File, because I haven’t see this in the Plugin Administration.

    Fedik for Joomla President:)

  7. tim says:

    Your filters are great! :)
    I have to admit, that your component is very complicated, but after two or three days working with, I understood how to set it up. It’s very customable and like I said, your filters.. I love them:)
    Thank you very much!

  8. Saif says:

    Thank you! This also fix DJ Image Slider problem :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>