jeudi 29 janvier 2015

Dialog box closing when clicking inside as-well as outside using .has(e.target).length === 0


Vote count:

0




Im incredibly confused, here's the website link just so you can get a glipse of what is happening: http://ift.tt/1Dm8UtH Try clicking on the complainant box (only dialog box I have setup thus far).


You will notice when you click on the outside of the dialog box, it goes away (i'll put the code below) which is what I wanted to do, however when implementing this code for the closing on the outside of the container, it now also closes if you click on the inside also...


Here's the relevant jquery code:





$(document).mouseup(function(e) {
if ($("#hex1, #show3, #window, #window1, #window2, #window3, #window4").has(e.target).length === 0) {

$("#window, #window1, #window2, #window3, #window4 ").css("display", "none");


$('.hex1').css("display", "inline-block");
$("#flowchart_container").css("display", "block")
$('#mail_container').css("display", "inline-block")
$('#mobile_container').css("display", "inline-block")
$('#fullpage > div > div.fp-slides > div > div.slide.fp-slide.fp-table.active > div > div > div.hi-icon-wrap.hi-icon-effect-1.hi-icon-effect-1a > a').css("visibility", "visible")
$('#by_mail').css("display", "block")
$('#by_mail_style').css("display", "block")
$('#shortdesc').css("display", "block");
}
});



P.S #window4 is the dialog box. The issue lies in the if statement at the start but I can't think of what would fix it. It might be important to note on the 'Contact Us' page, I have a form within my dialog box and it doesn't close when clicking the form but clicking the background of the dialog box makes it close.


Any help is greatly appreciated!



asked 33 secs ago







Dialog box closing when clicking inside as-well as outside using .has(e.target).length === 0

Aucun commentaire:

Enregistrer un commentaire