can't figure out how to add animation to this.

Discussion in 'JavaScript' started by HellBomb, Aug 10, 2010.

  1. #1
    Ok, I have a piece of javascript but i have no clue how to make the collapse and expand animated. Do you guys have any ideas on how i would do this?

    function toggle_collapse(B, E) {
        if (!is_regexp) {
            return false
        }
        var D = fetch_object("collapseobj_" + B);
        var A = fetch_object("collapseimg_" + B);
        var C = fetch_object("collapsecel_" + B);
        if (!D) {
            if (A) {
                A.style.display = "none"
            }
            return false
        }
        if (D.style.display == "none" || "open" == E) {
            D.style.display = "";
            if (!E) {
                save_collapsed(B, false)
            }
            if (A) {
                img_re = new RegExp("_collapsed\\.gif$");
                A.src = A.src.replace(img_re, ".gif")
            }
            if (C) {
                cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
                C.className = C.className.replace(cel_re, "$1")
            }
        } else {
            if (D.style.display != "none" || "closed" == E) {
                D.style.display = "none";
                if (!E) {
                    save_collapsed(B, true)
                }
                if (A) {
                    img_re = new RegExp("\\.gif$");
                    A.src = A.src.replace(img_re, "_collapsed.gif")
                }
                if (C) {
                    cel_re = new RegExp("^(thead|tcat)$");
                    C.className = C.className.replace(cel_re, "$1_collapsed")
                }
            }
        }
        return false
    }
    Code (markup):
     
    HellBomb, Aug 10, 2010 IP
  2. HellBomb

    HellBomb Active Member

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    80
    #2
    If it works well I will Pay you via PayPal
     
    HellBomb, Aug 13, 2010 IP