-1

I need to fire an event after stopPropagation has been called.

I am hiding the div on html click and when someone clicks on the notif_noti button I am showing the div which then loads some items with the id #freq.

The problem is #freq will be inside #notification_load which is inside of #notification_box and the stopPropagation is attached to #notif_noti and also #notification_box so basically when you click on these two items it will not fire the event I am trying to fire. e.g you can not .click() on #freq because it will not register because it is inside of #notification_box

Hopefully someone can help me as to how to achieve this. If you do not understand I will try to rewrite this for you.

Thanks

$("#notif_noti, #notification_box").click(function(event){
    event.stopPropagation(); 
});

$("#notif_noti").click(function() {
    $("#notification_box").show();
    $("#notification_load").html('<div style="width:100%; text-align:center;   height: 20px;line-height: 50px;padding-top: 20px;padding-bottom: 20px;color: #999;"><i class="fa fa-circle-o-notch fa-spin" style="font-size:20px;"></i></div>');
});

$("html").click(function() {
    $("#notification_box").hide();
});
<div id='notification_box'>
    <div id='notification_arrow'></div>
    <div id='notification_hd'>
        <span id='notification_header' style='padding-left:05px;'></span>
    </div>
    <div id='notification_load'></div>
</div>
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
jphillis
  • 3
  • 1

2 Answers2

0

Provide the full code snippet. remaining that once call the event.stopPropagation() method. it can not be resumed so you use the below work around:

var stop = false;
// do your logic here
if(stop){
    event.stopPropagation();
}
J.M.Farook
  • 183
  • 1
  • 8
  • refers this stack over flow link: http://stackoverflow.com/questions/7811959/how-to-continue-event-propagation-after-cancelling – J.M.Farook May 27 '15 at 07:36
0
$(document).mouseup(function (e)
{
var container = $("YOUR CONTAINER SELECTOR");

if (!container.is(e.target) // if the target of the click isn't the container...
    && container.has(e.target).length === 0) // ... nor a descendant of the container
{
    container.hide();
}

});

this works. thanks.

jphillis
  • 3
  • 1