Topic: Any jQuery gurus out there?
I'm having a minor jQuery issue and was wondering if any of you were experienced with it and could offer some insight.
Basically, I can't use jQuery's .css() function to select an element if I want to apply CSS to that element when the value of the CSS property either is, or contains a variable.
For instance the following function without jQuery works fine...
function leftScroll() {
if(tOffset < 10) {
tOffset = tOffset + 10;
document.getElementById("thumbs").style.marginLeft = tOffset + "px";
doscroll = setTimeout("leftScroll()", 30);
}
}But this one doesn't...
function leftScroll() {
if(tOffset < 10) {
tOffset = tOffset + 10;
$("thumbs").css("marginLeft", tOffset + "px");
doscroll = setTimeout("leftScroll()", 30);
}
}I've also tried passing a hash instead of a key/value pair as per the .css() function's alternate syntax:
$("thumbs").css({"marginLeft: " + tOffset + "px"});Any thoughts?