blueimp/JavaScript-Templates

Is it able to use effects of jquery ? (FadeIn, FadeOut)

Closed this issue · 1 comments

hi blueimp,
Really appreciate your wokrs. Just using your jQuery-Fiile-Uploader.
Faced a problem while changing the template.Tried to use FadeIn and FadeOut when returning Error, but coudn't get it.
Is it able to use jquery effect in template ? Example:
{% if (file.error) { %}
$(".error").fadeIn(2000);

Error {%=file.error%}
.

Thanks.

Basically you can use any JavaScript code you want in the Template files, as it is just that, JavaScript.
However, it doesn't make sense to apply fade effects on elements that have not been rendered yet.
Since the code in the templates will be executed before they are added to the Browser DOM, calling .fadeIn or any other animation effects will have no effect.

I would recommend you to apply your fade effects after template has been rendered.
This is the way jQuery File Upload does it when adding/removing the upload rows.