Here's a first attempt at jQueryizing servOC(). It could probably be better,
but I wanted something that was a drop-in replacement:

function servOC(i, href, nColor) {
   var trObj = jQuery("#ihtr" + i);
   var nameObj = jQuery("#name" + i);
   var ifObj = jQuery("#ihif" + i);

   if(trObj.css("display") == "none") {
       trObj.css("display", "");
       nameObj.css("background", "#ECECD9");
       if(!ifObj[0].src) ifObj.attr("src", href);
       ifObj.animate({height: 210}, "slow");
   } else {
       nameObj.css("background", nColor);
       ifObj.animate({height: 0}, "slow", "linear", function() {
           trObj.css("display", "none");
       });
   }
}

One thing I noticed is that their animation is a *lot* smoother (I haven't
worked with jQuery's animation components much, so I'm not entirely sure who
to blame here (me or jQuery 1.1.1))

On 5/2/07, Aaron Heimlich <[EMAIL PROTECTED]> wrote:

On 5/2/07, Rey Bango <[EMAIL PROTECTED]> wrote:
>
> Could someone help me learn how to do that?
>

This function[1] is attached to the "click" event of each of the table
rows:

<tr ... onclick="servOC(1, '/torrent_details/14577207/300', '#eaedf4')"
...>

function servOC(i, href, nColor) {
    var trObj = document.getElementById ? document.getElementById("ihtr" +
i) : eval("document.all['ihtr" + i + "']");
    var nameObj = document.getElementById ? document.getElementById("name"
+ i) : eval("document.all['name" + i + "']");
    var ifObj = document.getElementById ? document.getElementById("ihif" +
i) : eval(" document.all['ihif" + i + "']");
    if (trObj != null) {
        if (trObj.style.display == "none") {
            ifObj.style.height = "0px";
            trObj.style.display = "";
            nameObj.style.background = "#ECECD9";
            if (!ifObj.src) {
                ifObj.src = href;
            }
            smoothHeight("ihif" + i, 0, 210, 42, "o");
        } else {
            nameObj.style.background = nColor;
            smoothHeight("ihif" + i, 210, 0, 42, "ihtr" + i);
        }
    }
}

From what I can tell, it basically slides up/down an iframe that resides
in a hidden row directly below the row that user clicked on.

[1] http://isohunt.com/js/functions.js

--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com




--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com

Reply via email to