Annulé

AJAX, jQuery / Prototype, PHP Job by RAELWEB

Hi there,

I have integrated AdGallery ([url removed, login to view]) into Phpfox for the user profile photos section. I added some extra code to use the phpFoX AJAX functionality to get comments and photo details for each photo when clicked.

The problem is that with each AJAX call done through phpfox a javascript function called loadInit() is run which does the following:

$('*').unbind();

$.each($Behavior, function()

{

this(this);

});

This removes all the event triggers from the gallery and so it no longer works after the first AJAX call. If I create a new function loadInit2 and change it to this:

$.each($Behavior, function()

{

this(this);

});

And then force phpfox to use that function during AJAX instead, then everything in the gallery still works as the events are still binded, 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. And I really want to get this working without ugly hacks.

So onto the problem. You can set '$Behaviors' in phpfox javascript files which will be binded after each run of the loadInit function by phpfox. So it should be easy to rebind everything. However, the gallery was not designed to be instantiated twice (obviously) so if I do the following

$Behaviors addGallery = {

var galleries = $('.ad-gallery').adGallery();

}

It works fine the first time the page loads, but after an ajax call (when it runs this behavior again after unbinding and rebinding all the $Behaviors) 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, next/prev buttons not working correctly etc.

Sadly JQuery is my weakest skill and the gallery code is beyond me. What I need doing is the creation of two functions, or the splitting of the single adgallery function. I need the gallery to be initialized on page load as it is now, then I need a new function (or part of the original) which can be run with each AJAX call which will rebind all the necessary Jquery events for the gallery without causing any abnormal behavior, ensuring all buttons (e.g next/prev image) and thumbnail navigation work correctly.

Please do let me know if you feel this is something you can help with.

Kind regards,

Richard

Compétences : AJAX, jQuery / Prototype, PHP

Voir plus : photo editing profile, reload page jquery, jquery reload page, quirky, prev, images editing project, change skill, jquery instead, without page reload, jquery adgallery, jquery behavior, image gallery jquery, jquery force, comment section ajax, ajax call, 2009 2009 2012, ajax comment section, image gallery plugin, jquery load http page, jquery plugin help, ajax image load, ajax image plugin, phpfox profile page, load ajax image, jquery thumbnails

Concernant l'employeur :
( 0 commentaires ) Peterborough, United Kingdom

N° du projet : #2354008

1 freelance fait une offre moyenne de $20 pour ce travail

gafprogrammer

Hired by the Employer

$20 USD / heure
(293 Commentaires)
7.4