Skip to content Skip to sidebar Skip to footer

Jquery Fancybox Link Inside Div

I have a div containing information. Wraped around the div I have a 'a' tag so that when a user clicks anywhere around the div the fancy box opens. However inside the div I andothe

Solution 1:

Updated:This code should most probably work.

$(".listContent").live('click', function(e) {
    e.preventDefault();
    $(this).fancybox({
        'type': 'ajax'
    });
    console.log('inside fancybox creator');
});

$("div.removeCompare").live('mousedown', function(e) {
    e.stopPropagation();
    console.log('inside remove');
    $(this).parents(".listingContainer").remove();
});

I think your problem was with event propagation - when you click on a child element the related event of parent too fires up. So e.stopPropagation() will stop that.

Solution 2:

Inside the click event function of the div, unbind the mouseenter event for the inner element (which opens the fancybox), using the .die('mouseenter') event handler unbinding syntax.

Post a Comment for "Jquery Fancybox Link Inside Div"