So I had the need today to use jQuery selectors in SIFR (whose selectors are pretty weak). Unfortunately, sifr only takes selectors, so I did a little hacking:

Added the following on line 454 of sifr.js
        /* Check if we can find any nodes first */
        if(sSelector.parentNode) {
            listNodes = [sSelector];
        }
        else {
            var listNodes = parseSelector(sSelector);
            if(listNodes.length == 0){ return false };
        }

replacing:

            var listNodes = parseSelector(sSelector);
            if(listNodes.length == 0){ return false };

Then, I created a little plugin:

jQuery.fn.sIFR = function(namedHash) {
  $(this).each(function() {
    if(typeof sIFR == "function") {
      sIFR.replaceElement(this, named(namedHash));
    }
  });
}

the namedHash is the hash required by sIFR, so you can now do stuff like $(".links > li:not([ul])").sIFR({
        sFlashSrc: "sifr/gotham.swf",
        sColor: "#666666",
        sHoverColor: "#983434"
        });

--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to