arvgta / ajaxify

Ajaxify - An Ajax Plugin
https://4nf.org/
275 stars 124 forks source link

Animations are not applied if ajaxify two components #55

Closed jfuentesa closed 9 years ago

jfuentesa commented 9 years ago

Animations are not applied if ajaxify two components:

In this example the animation acts over the first element. Not for both.

jQuery('#breadcrumbs, #content').ajaxify({ selector: "a:not(.no-ajaxy):not([target='_blank'])", requestDelay: 0, previewoff: true, idleTime: 0, slideTime: 0, menu: false, addclass: "jqhover", forms: false, prefetch: false, memoryoff: true, aniTime: 400, aniParams: { opacity: 0 } });

arvgta commented 9 years ago

Thanks for trying out the new animations!

Yes, not documented properly yet, but animations are performed on the first element only, assuming that this is the most important content div of the user.

I should really document that...

Would you expect different behaviour?

I can't think of a way to extend it to animate several elements passed in the selection at the moment. It would be quite tricky...

Documentation changed on the interface page

jfuentesa commented 9 years ago

Could be with $(this).each() in https://github.com/arvgta/ajaxify/blob/new/ajaxify.js#L288 ?

arvgta commented 9 years ago

Thanks for suggesting the change and even pinpointing the proposed line number!

However, there would be several of lines of code, that would be multiplexed, when applying the each().

It would be necessary to isolate the animation code only and multiplex it. The same animation, however complex, would be applied to every element...

If you only want to perform a fade, you can do so be hooking into the Pronto events manually and performing it on the desired element additionally.

There are shorthands you could use (fadeIn() / fadeOut())...

I'll leave this issue open, for the moment, for others to post their opinion, too...

If you feel like coding the change, then please contemplate opening a pull request.

Thanks again!

jfuentesa commented 9 years ago

Ok, I'll do it with Pronto events, thank you for your support :)

arvgta commented 9 years ago

Great stuff! Please re-open, if anyone runs into trouble...