How do I bind the Overlay Tool for new Ajax elements in Jquery?

Posted by Hooman Ahmadi on Stack Overflow See other posts from Stack Overflow or by Hooman Ahmadi
Published on 2009-11-03T01:04:41Z Indexed on 2010/04/16 20:03 UTC
Read the original article Hit count: 225

Filed under:
|
|
|
|

Hi,

I'm using:

echo $javascript->link('tools.overlay-1.0.4', false);

which is initialized with:

$(".overlay_popup").overlay({
    expose: '#000000',
    close: '.close_overlay',
    finish: {
        top: 'center',
        left: 'center',
        absolute: false
    }
});

I call the overlay popup box like this:

echo $html->link(
    "add part",
    array('controller'=>'garage_parts',
        'action'=>'addfrompartlist',
        $gcar['GarageCar']['id'],
        $gcar['GarageCar']['car_id']),
    array('class'=>'js-ajax overlay_popup',
        'id'=>'add_part_overlay',
        'rel'=>'.overlay_container')
);

This all works fine and dandy, however I have an ajax function that dynamically adds the "add part" hyperlink button shown above and I have no idea how to bind this new button to the overlay. Normally, I would use something like this:

$(".overlay_popup").bind("click", function(){... but this didn't work for the overlay. Any ideas on how I can successfully do this?

© Stack Overflow or respective owner

Related posts about overlay

Related posts about jQuery