Click event count on page using jquery


$(document).click(function(e)
  {
    if(e.currentTarget.activeElement.attributes[0])
    {
      var idClicked = e.currentTarget.activeElement.attributes[0].value;
    }
    if (e.currentTarget.activeElement.attributes[1])
    {
      var idClicked1 = e.currentTarget.activeElement.attributes[1].value ;
    }
    if (idClicked == 'loginbutton' || idClicked1 == 'loginModal' || idClicked1 == 'close')
    {
    }
    else
    {
        var auth_token = $.session.get("auth_token");
        var user_id = $.session.get("user_id");
        var pathname = window.location.pathname;
        var patharray = pathname.split("/");
        var pageurl = patharray[patharray.length - 1];
        if (!(auth_token && user_id) && pageurl != "register.php")
        {
          var clickcount = $.session.get("clickcount");
          if (clickcount) {
            clickcount++;
          } else {
            clickcount = 1;
          }
          $.session.set("clickcount"clickcount);
          var newclickcount = $.session.get("clickcount");
          if (newclickcount > 10)
          {
            $('.modal').modal('hide');
            $("#loginModal").modal("show");
            $.session.set("clickcount"0);
          }
        }
    }


  });

About Sudhir Kumar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 σχόλια :

Post a Comment