jQuery - How to animate click function without clicking (Slide-show like) - Is this possible?

Posted by iamtheratio on Stack Overflow See other posts from Stack Overflow or by iamtheratio
Published on 2010-03-17T13:42:20Z Indexed on 2010/03/18 9:21 UTC
Read the original article Hit count: 216

Hello, I have created a jQuery script (with help) that works great however I need it to automate/animate itself without using the click function, I just want to know is this possible and if so, how? Similar to a slide-show.

Basically the code allows me to click on an image and hide/show a DIV, while changing a list of elements such as class/id name.

Here's my 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;
    });
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about automation