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){

or use callback function:

function doSomethingAfterFAjxPagLoad (){

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

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” ( ):

if(location.toString().indexOf('/galery') != -1){

To be continued, maybe … :)

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

  1. юрий says:

    Здравствуйте. Подскажите пожалуйста, как подружить fullajax и модуль rocktabs. Все вроде как работает, но после обновления страницы пропадает анимация, в google chrome в режиме разработчика сразу появляется ошибка. Пример некорректной работы на сайте Если не затруднит помогите с решением. Просто не очень силен в mootools

  2. Johnebyne says:


  3. Reza says:

    Your work is really great. but there is a big problem.
    my custom javascript codes will add event listener to some objects. and I knew that every time I change my page, ajax will add another callback to my functions and because of this, my objects will trigger events more than one time (it will trigger the number of every ajax loaded page.). and for example if I added an event to ‘click’, it will trigger more than one and my codes will not work true. is anyway that I could remove callback from your codes?
    it is really necessary

    • Fedik says:

      for prevent link wrapping (add own callback) by FullAJAX you can add attribute ax:wrap="0", like:

      < a href="/some-link" ax:wrap="0" >Some text</ a >

      or use FLAX.filter

  4. wrfw says:

    Hello How does it work with language-switcher?
    i tried semi-auto.

    only the article changes, when selecting language,
    sidebar stays in language..

    any idea?

  5. wrfw says:

    id is not the same like my example ;)

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>