views:

16

answers:

1

Right now I have:

$("#myElement").bind("buildTimeline", function (event, newViewObj) {
    curDomObj = $(this).children(".timeline"); //this refers to #myElement

    curDomObj.draggable({
        axis:"x",
        drag:curDomObj.trigger("drag")
    });
});

I'd much rather just have one chain, but is there a way to refer to the current element at your position in the chain?:

$(this).children(".timeline").draggable({
    axis:"x",
    drag:$(this).trigger("drag") //this still refers to #myElement, but I want
                                 //it to refer to #myElement .timeline
});
A: 

What about:

$("#myElement").bind("buildTimeline", function (event, newViewObj) {
    $(this).children(".timeline").draggable({
        axis:"x",
        drag:$(this).children(".timeline").trigger("drag")
    });
});
Daniel Mendel
I'd like to avoid touching the dom (using $(this).children(".timeline") again) an extra time like this (not that I know if it even really does)
JustcallmeDrago
Well ultimately I think you have the best solution already, you'll probably have to get used to breaking the chain that way at times if you want to keep optimal performance.
Daniel Mendel
Alright, then. Thanks!
JustcallmeDrago