There's no need to pass it. Since var $id and your callback are in the same
function-scope, a closure provides access. Here's a simpler example to
illustrate:

$(document).ready(function() {
  var i = 3;
  $("div").click(function() {
    alert(i); // i and div.click fn are in the same function scope -
document.ready
  });
});

- Richard

Richard D. Worth
http://rdworth.org/

On Tue, Apr 15, 2008 at 5:07 PM, Donald <[EMAIL PROTECTED]> wrote:

>
> Is i possible to pass arguments to callback functions right now I
> have:
>
> $(".imagethumb").each(function() {
>    $(this).bind( \'click\', function() {
>        var $id = $(this)[0].id;
>        $("#prodimage").fadeOut("slow",
>            function($id) {
>                $("#prodimage")[0].src = $("#" + id ).attr( \'fullsize
> \' );
>                $("#prodimage").fadeIn("slow");
>            });
>        }
>    );
> });
>
> When it gets to the callback function for fadeOut $id is null.  How do
> I fix this??
>

Reply via email to