Hi,

Great little module, looks like that's exactly what I need for my project. Thanks !

There is a problem with the toggle effect though... The first time I click on the link, the content is loaded correctly but the class jquery_ajax_load_open is not added to the link. So when I click a second time to close it, the content is loaded again instead of being hidden. This time the class is correctly added, so the third click actually hides the content.

Nick

Comments

nicolas bouteille’s picture

jquery_ajax_load.js line 66 $(el).addClass( "jquery_ajax_load_open" );

class jquery_ajax_load_open is added inside the callback function of the ajax call
$(target).load('/jquery_ajax_load/get' + url, function() {

In my case, the ajax call generated an error because of ShareThis. But the rest of the page was successfully displayed so the class jquery_ajax_load_open should have been added anyway.

In the end I think it would be better to add the open class after the ajax call, not inside callback function...

hatuhay’s picture

The reason why the class is added inside the load function is because it is the only way to assure that tha call was succesfull.
Otherwise you could end up adding classes when the call returned and error.

nicolas bouteille’s picture

Ok but what is wrong with adding classes when the call returns an error ? I mean in my case this is a small error regarding ShareThis that makes the call return an error. But the rest of the page is loaded and displayed. So I would be better off with a class that is being added anyway, wether the call returns successfully or not.
Why would you not want the 'open' class to be added if the call returns an error ? I mean, if the call returns an error because the serveur is not responding or the url is not good, then we've got a bigger problem than just a class that is being added when it shouldn't... since nothing is displayed at all...

hatuhay’s picture

I mean "if the call was succesfull, then add the class".
So the class is added inside the callback function.
What you are saying is that the content is loaded, but the call was unsuccessful, so the class "open" was not added eventhough it is actually "open".

nicolas bouteille’s picture

yes exactly, that's what I say, and that's what you say... what you don't say is why you say so :)
why do you need the 'open' class added only if the call was successful ?

hatuhay’s picture

Because I never expected the callback content to be loaded even if if the call was not sucessful.

nicolas bouteille’s picture

I did not ask you 'why did you do that in the first place' ? That I know.
But it looks like that even now that you now that the content can be loaded even if the call was not successful you still think it's better to leave it that way. Am I right ? If yes then I want to know 'why you NEED it to stay that way' ? But maybe you are planning to move the class outside as I suggested and I just did not understand that...

hatuhay’s picture

Believe me when I say that I appreciate your comments.
Changes are on today's DEV version, will test it for a few days before issuing a new release.
On your point, I was reviewing the hole error handling.
On the new version, page handling related errors will be shown on target div, only first time you try to load it, I mean for example 403 or 404.
I have to say that in this cases the after callback function works so, I have the chance to handle the error.
Since I cannot reproduce the case you mention, I do not know the effect on this case.
But I have to assume that the after callback function is not call, so error handling will not be posible.
Toggle open class is added outside callback function, so first time toggle should be OK.
Please let a time for Drupal to update DEV version, test it and let me know.

nicolas bouteille’s picture

Sorry I won't be allowed to use the dev version on te site I am working right now which is where I have this error so a sandbox site wouldn't help. I don't know what to do... lack of time also... I'll see what I can do.

hatuhay’s picture

Status: Active » Closed (works as designed)
abaier’s picture

Any updates on this behavior?

I am trying to get a view (many teasers in a grid) working with this module where the teasers load the node-contents into the header of the view. Everything works fine (esp. after patching the multilingual url-pattern), but unfortunately the class .jquery_ajax_load_open will be added to all clicked links. I would expect it to be removed from the previously clicked links so that I could style the currently activated and viewed node.

Any ideas of fixing this in the module to avoid jquery fixes?

Thanks in advance,
Anton

abaier’s picture

Additional information: My previous comment describes the situation with toggle and animations disabled.

If toggle is activated the class is toggled only by clicking the activated and loaded teaser (node) again. When an other teaser is clicked, the first node will toggle content and class, but will not open up the next node instantly. For this another click on the teaser is required.