Good morning,
On one page, I have some div that I've put an effect on for them to appear (toogle) I would like this effect to be rotated whenever I execute its function.
So, I discovered this function that shuffles the contents of an array
function embaralhar_efeito(o){
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o[0]; //retorna somente o 1 valor.
}
var array_efeitos = ['slideToggle','slideDown','slideUp','fadeToggle','fadeTo','fadeIn'];
var efeito_toogle = embaralhar_efeito(array_efeitos);
So, I pass the result to the function that would make toogle in my div:
function efeito_pergunta(efeito){
var modifica = '$("#div_pergunta").';
var modifica_2 = efeito+'(3000);';
var acao = modifica + modifica_2;
}
When the alert is triggered, it returns $ ("# div_quest"). slideDown (3000); // here, the effect (slideDown) changes as it performs the shuffle_ effect. But the div does not get the effect of toogle.
Can you execute the code like this?
Ha ha, grateful