mercredi 2 mars 2016

Javascript if statement is not running

I want to open my bottommodal1 if the if statement is correct but it is not working. If I place $('#bottommodal1').openModal(); outside the if clause it works fine so the problem must be on of the two if's. I hope anyone can tell me what is wrong because i am not familiar with javascript.

Thank you

$('.modal-trigger1').click(function() {

    var points_y_array = 2;
    var points_x_array = 2;    
    var polygone_right = 4; 
    var polygone_left = 1;
    var polygone_bottom = 1;
    var polygone_top = 4;

    if(points_x_array >= 0 && points_y_array >= 0){

        if(points_y_array >= polygone_bottom && points_y_array <= polygone_top && points_x_array >= polygone_left && points_x_array <= polygone_right ){
          $('#bottommodal1').openModal();

        }    
    }
});

Aucun commentaire:

Enregistrer un commentaire