1

Okay, so I have a div that pops up when it is opened. When the div is open (showing) when you click anywhere in the window that ISN'T the div itself, it closes the div. When I click IN the pop out div it stays open - as should) All that works...

However when I RIGHT-CLICK inside the div, JQuery treats it as if it was a click outside of the div and closes it --> I don't want this to happen. I want it to stay open the same way it does when you left click inside of it.

Here is the code.

NOTE: THIS CODE IS WORKING. HOWEVER I NEED TO ADD SOMETHING TO STOP THE ISSUE STATED ABOVE.

$(document).ready(function(){ 

    $("#showpopup").click(function( e ) {
       e.stopPropagation();
       document.body.style.overflow = 'hidden';
       $("#mainpopout").show();
    });

    $("#actualpopout").on('click',function( e ){
         e.stopPropagation();
    });

    $(document).on('click', function( e ) {
       if( e.target.id != 'actualpopout' ){
           $("#mainpopout").hide();
           document.body.style.overflowY = 'scroll';
       }   
    });

});
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Chrisl446
  • 303
  • 2
  • 11

0 Answers0