Integrating JQuery gallery (ADGallery) into phpfox, unbind(*) breaking gallery when using AJAX
<p>Sorry this is a bit long. I have successfully integrated <a href="http://coffeescripter.com/2009/07/ad-gallery-a-jquery-gallery-plugin/" rel="nofollow">AdGallery</a> into phpfox for the user profile photos section. I added some code to use AJAX to get comments and photo details when a photo is clicked.</p>

<p>The problem is that with each AJAX call done through phpfox a javascript function called loadInit is run which does the following:</p>

<pre><code>$('*').unbind();

$.each($Behavior, function() 
{       
    this(this);
});
</code></pre>

<p>This removes all the click events from the gallery and so it no longer works. If I create a new function loadInit2 and change it to this:</p>

<pre><code>$.each($Behavior, function() 
{       
    this(this);
}); 
</code></pre>

<p>Then everything in the gallery still works however it has 2 drawbacks; firstly it requires editing core phpfox files rather than being a plugin, and secondly it causes quirky behavior with comments, such as each additional comment without a page reload will add 2 duplicate comments, then 3, then 4 etc.</p>

<p>So onto the problem. You can set $Behaviors in the javascript files which will be binded after each run of loadInit by phpfox, however the gallery was not designed to be instantiated twice so if I set the var galleries = $('.ad-gallery').adGallery(); as a $Behavior it gets totally confused trying to start from scratch when a gallery is already there and I get very odd behavior such as image thumbnails sliding all over the place, images overlapping etc.</p>

<p>What I am looking to do is split it up into two pieces, one bit which runs with the page load and creates the gallery, then a second chunk which can be made as a $Behavior which will set all the events and which will run happily after each AJAX call.</p>

<p>There is too much code to post here but the link to the gallery is: <a href="http://coffeescripter.com/2009/07/ad-gallery-a-jquery-gallery-plugin/" rel="nofollow">http://coffeescripter.com/2009/07/ad-gallery-a-jquery-gallery-plugin/</a></p>

<p>I know this is a big ask but would be willing to pay for someone who can give me their time to help with this if needed. Thanks.</p>
