J'ai créé un script jQuery (avec aide) qui fonctionne très bien mais j'en ai besoin pour automatiser/animer sans utiliser la fonction click, je veux juste savoir si c'est possible et si oui, comment? Similaire à un diaporama.jQuery - Comment animer la fonction de clic sans cliquer (Slide-show like) - Est-ce possible?
Fondamentalement, le code me permet de cliquer sur une image et masquer/afficher un DIV, tout en changeant une liste d'éléments tels que le nom de classe/id.
Voici mon code:
JQUERY:
jQuery(document).ready(function(){
//if this is not the first tab, hide it
jQuery(".imgs:not(:first)").hide();
//to fix u know who
jQuery(".imgs:first").show();
//when we click one of the tabs
jQuery(".img_selection a").click(function(){
//get the ID of the element we need to show
stringref = jQuery(this).attr("href").split('#')[1];
// adjust css on tabs to show active tab
$('.img_selection a').removeAttr('id'); // remove all ids
$(this).attr('id', this.className + "_on") // create class+_on as this id.
//hide the tabs that doesn't match the ID
jQuery('.imgs:not(#'+stringref+')').hide();
//fix
if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0") {
jQuery('.imgs#' + stringref).show();
} else
//display our tab fading it in
jQuery('.imgs#' + stringref).show();
//stay with me
return false;
});
});
I tout à fait n'obtenez pas quel est votre problème ici ... Si vous voulez l'appeler automatiquement, appelez-le simplement sur document prêt ou en utilisant setTimeout? – marcgg
Je suis nouveau à tout cela, donc je ne suis pas vraiment sûr de savoir comment faire, plus de perspicacité? J'adorerais l'aide! – iamtheratio